Class CosmosClientFactory
Builds CosmosClients configured the way this provider expects: the
CosmosEntitySerializer (System.Text.Json web defaults + the modeling annotations, and the
model's Converts registrations when a model is given) — wired as a CosmosLinqSerializer
so LINQ member names resolve through the same contract — and bulk execution enabled so a buffered
Commit flushes as one batched set of point writes.
public static class CosmosClientFactory
- Inheritance
-
CosmosClientFactory
- Inherited Members
Properties
SerializerOptions
The System.Text.Json options used to (de)serialize documents when no model is supplied.
public static JsonSerializerOptions SerializerOptions { get; }
Property Value
Methods
Create(string)
Creates a client from a connection string with the default options.
public static CosmosClient Create(string connectionString)
Parameters
connectionStringstringThe Cosmos connection string.
Returns
Create(string, CosmosModel, ILoggerFactory?)
Creates a client whose serializer carries the model's value converters.
public static CosmosClient Create(string connectionString, CosmosModel model, ILoggerFactory? loggerFactory = null)
Parameters
connectionStringstringThe Cosmos connection string.
modelCosmosModelThe Cosmos model.
loggerFactoryILoggerFactoryThe logging factory feeding the request log/metrics pipeline, or
null.
Returns
DefaultOptions()
The default client options (annotation-aware serializer, bulk execution enabled).
public static CosmosClientOptions DefaultOptions()
Returns
OptionsFor(CosmosModel, ILoggerFactory?)
The client options for a model (its Converts registrations join the serializer).
public static CosmosClientOptions OptionsFor(CosmosModel model, ILoggerFactory? loggerFactory = null)
Parameters
modelCosmosModelThe Cosmos model.
loggerFactoryILoggerFactoryThe logging factory feeding the request log/metrics pipeline, or
null.