Class AppConfiguration
A class exposing configuration options for a App.
Namespace: Realms.Sync
Assembly: Realm.dll
Syntax
public class AppConfiguration
Constructors
| Edit this page View SourceAppConfiguration(string)
Initializes a new instance of the AppConfiguration class with the specified appId
.
Declaration
public AppConfiguration(string appId)
Parameters
Type | Name | Description |
---|---|---|
string | appId | The Atlas App Services App id. |
Properties
| Edit this page View SourceAppId
Gets the unique app id that identifies the Realm application.
Declaration
public string AppId { get; }
Property Value
Type | Description |
---|---|
string | The Atlas App Services App's id. |
BaseFilePath
Gets or sets the root folder relative to which all local data for this application will be stored. This data includes metadata for users and synchronized Realms.
Declaration
public string BaseFilePath { get; set; }
Property Value
Type | Description |
---|---|
string | The app's base path. |
BaseUri
Gets or sets the base url for this Realm application.
Declaration
public Uri BaseUri { get; set; }
Property Value
Type | Description |
---|---|
Uri | The app's base url. |
Remarks
This only needs to be set if for some reason your application isn't hosted on services.cloud.mongodb.com. This is typically the case when synchronizing with an edge server.
DefaultRequestTimeout
Gets or sets the default request timeout for HTTP requests to MongoDB Atlas. Default is 1 minute.
Declaration
public TimeSpan DefaultRequestTimeout { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan | The default HTTP request timeout. |
HttpClientHandler
Gets or sets the HttpMessageHandler that will be used for the http requests to MongoDB Atlas.
Declaration
public HttpMessageHandler? HttpClientHandler { get; set; }
Property Value
Type | Description |
---|---|
HttpMessageHandler | The http client handler that configures things like certificates and proxy settings. |
Remarks
You can use this to override the default http client handler and configure settings like proxies, client certificates, and cookies. While these are not required to connect to MongoDB Atlas under normal circumstances, they can be useful if client devices are behind a corporate firewall or use a more complex networking setup.
LocalAppName
Gets or sets the local app's name.
Declaration
[Obsolete("This property has no effect and will be removed in a future version.")]
public string? LocalAppName { get; set; }
Property Value
Type | Description |
---|---|
string | The friendly name identifying the current client application. |
LocalAppVersion
Gets or sets the local app's version.
Declaration
[Obsolete("This property has no effect and will be removed in a future version.")]
public string? LocalAppVersion { get; set; }
Property Value
Type | Description |
---|---|
string | The client application's version. |
See Also
| Edit this page View SourceMetadataEncryptionKey
Gets or sets the encryption key for user metadata on this device.
Declaration
public byte[]? MetadataEncryptionKey { get; set; }
Property Value
Type | Description |
---|---|
byte[] | The user metadata encryption key. |
Remarks
This will not change the encryption key for individual Realms. This should still be set in EncryptionKey when opening the Realm.
MetadataPersistenceMode
Gets or sets the persistence mode for user metadata on this device.
Declaration
public MetadataPersistenceMode? MetadataPersistenceMode { get; set; }
Property Value
Type | Description |
---|---|
MetadataPersistenceMode? | The user metadata persistence mode. |
Remarks
The default value is Encrypted for iOS devices and NotEncrypted for all other platforms. On iOS we integrate with the system keychain to generate and store a random encryption key the first time the app is launched. On other platforms, MetadataEncryptionKey needs to be set if Encrypted is specified.
OnSyncWebSocketConnection
Gets or sets the delegate that will be used to configure outgoing WebSocket connections to MongoDB Atlas.
Declaration
public Action<ClientWebSocketOptions>? OnSyncWebSocketConnection { get; set; }
Property Value
Type | Description |
---|---|
Action<ClientWebSocketOptions> | The delegate that will be used to configure outgoing WebSocket connections. |
Remarks
You can use this to modify the default ClientWebSocket behavior. Normally this is not
required to connect to MongoDB Atlas, but it can be useful if client devices are behind a corporate firewall
or use a more complex networking setup. Requires that UseManagedWebSockets is set to true
.
SyncTimeoutOptions
Gets or sets the options for the assorted types of connection timeouts for sync connections opened for this app.
Declaration
public SyncTimeoutOptions SyncTimeoutOptions { get; set; }
Property Value
Type | Description |
---|---|
SyncTimeoutOptions | The sync timeout options applied to synchronized Realms. |
UseAppCache
Gets or sets a value indicating whether to cache app instances created with this configuration.
Declaration
public bool UseAppCache { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
Remarks
When an app is created using Create(AppConfiguration), the default behavior is to get or add the App instance from a cache keyed on the app id. This has certain performance benefits when calling Create(AppConfiguration) multiple times.
UseManagedWebSockets
Gets or sets a value indicating whether the .NET WebSocket client or the built-in Realm WebSocket client will be used for Sync traffic.
Declaration
public bool UseManagedWebSockets { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
Remarks
The default value is false
, but this will change in a future version.