RepositoryOptions
A repository options class, representing
Namespace: Microsoft.Azure.CosmosRepository.Options
Kind: class
A repository options class, representing various Azure Cosmos DB configuration settings.
public class RepositoryOptionsExample
Members
Propertys
RepositoryOptions.CosmosConnectionString
Gets or sets the cosmos connection string. Primary or secondary connection strings are valid.
public virtual string? CosmosConnectionString { get; set; }Returns — String
RepositoryOptions.AccountEndpoint
Gets or sets the cosmos account endpoint URI. This can be retrieved from the Overview section of the Azure Portal. This is required if you are authenticating using tokens.
In the form of https://{databaseaccount}.documents.azure.com:443/, see:
public Uri? AccountEndpoint { get; set; }Returns — Uri
RepositoryOptions.DatabaseId
Gets or sets the name identifier for the cosmos database.
public virtual string DatabaseId { get; set; }Returns — String
Defaults to “database”, unless otherwise specified.
RepositoryOptions.ContainerId
Gets or sets the name identifier for the cosmos container that corresponds to the DatabaseId.
public virtual string ContainerId { get; set; }Returns — String
Defaults to “container”, unless otherwise specified.
RepositoryOptions.OptimizeBandwidth
Gets or sets whether to optimize bandwidth.
When false, the EnableContentResponseOnWrite is set to false and only
headers and status code in the Cosmos DB response for write item operation like Create, Upsert,
Patch and Replace. This reduces networking and CPU load by not sending the resource back over the
network and serializing it on the client.
public bool OptimizeBandwidth { get; set; }Returns — Boolean
Defaults to true, see: https://devblogs.microsoft.com/cosmosdb/enable-content-response-on-write
RepositoryOptions.ContainerPerItemType
Gets or sets whether to create a container per item. When true, a container for type Foo will be persisted in
a “Foo” container, and type Bar will be persisted in a “Bar” container, and so on. When false, all items share
a container - because it doesn’t really matter.
public bool ContainerPerItemType { get; set; }Returns — Boolean
Defaults to false, see: https://learn.microsoft.com/azure/cosmos-db/how-to-model-partition-example?WC.m_id=dapine
RepositoryOptions.AllowBulkExecution
Gets or sets whether optimistic batching of service requests occurs. Setting this option might impact the latency of the operations. Hence this option is recommended for non-latency sensitive scenarios only.
public bool AllowBulkExecution { get; set; }Returns — Boolean
Defaults to false, see: https://devblogs.microsoft.com/cosmosdb/introducing-bulk-support-in-the-net-sdk
RepositoryOptions.SyncAllContainerProperties
Get or sets whether or not to sync all container properties. Setting this option will mean all containers when created for the first time will ensure that
the container properties are up to date.
If you want to specify this at the container level see ContainerBuilder
public bool SyncAllContainerProperties { get; set; }Returns — Boolean
RepositoryOptions.SerializationOptions
Gets or sets the repository serialization options.
public RepositorySerializationOptions? SerializationOptions { get; set; }Returns — RepositorySerializationOptions
RepositoryOptions.TokenCredential
The TokenCredential which can be used to access azure resources, including Cosmos DB.
public TokenCredential? TokenCredential { get; set; }Returns — TokenCredential
RepositoryOptions.ContainerBuilder
A builder to configure containers. Ensure that ContainerPerItemType is set to true for the container name configured here to take affect.
public IItemContainerBuilder ContainerBuilder { get; }Returns — IItemContainerBuilder
RepositoryOptions.IsAutoResourceCreationIfNotExistsEnabled
Used to tell the SDK whether or not to try and creates databases and containers if they do not exist.
public bool IsAutoResourceCreationIfNotExistsEnabled { get; set; }Returns — Boolean
This feature is very powerful for local development. However, in scenarios where infrastructure as code is used this may not be required.
RepositoryOptions.DisableTracing
Gets or sets a boolean value that indicates whether the OpenTelemetry tracing is disabled or not.
public bool DisableTracing { get; set; }Returns — Boolean: The default value is false.
Fields
RepositoryOptions.CosmosConnectionStringConfigKey
The configuration key used for the connection string.
public const string CosmosConnectionStringConfigKey = "RepositoryOptions:CosmosConnectionString"Returns — String
RepositoryOptions.DatabaseIdConfigKey
The configuration key used for the database ID.
public const string DatabaseIdConfigKey = "RepositoryOptions:DatabaseId"Returns — String