Exemplo n.º 1
0
        public AzureCosmosDataProvider(Action <IAzureCosmosProviderConfigurator> config)
        {
            var cosmosDbConfig = new AzureCosmosProviderConfigurator();

            config.Invoke(cosmosDbConfig);
            EndpointBuilder         = cosmosDbConfig._endpointBuilder;
            AuthKeyBuilder          = cosmosDbConfig._authKeyBuilder;
            ContainerBuilder        = cosmosDbConfig._containerBuilder;
            DatabaseBuilder         = cosmosDbConfig._databaseBuilder;
            ConnectionPolicyBuilder = cosmosDbConfig._connectionPolicyBuilder;
            DocumentClient          = cosmosDbConfig._documentClient;
            IdBuilder = cosmosDbConfig._idBuilder;
        }
        /// <summary>
        /// Store the events in an Azure Cosmos database.
        /// </summary>
        /// <param name="config">The Azure Cosmos provider configuration.</param>
        public static ICreationPolicyConfigurator UseAzureCosmos(
            this IConfigurator configurator, Action <IAzureCosmosProviderConfigurator> config)
        {
            var cosmosDbConfig = new AzureCosmosProviderConfigurator();

            config.Invoke(cosmosDbConfig);

            Configuration.DataProvider = new AzureCosmosDataProvider()
            {
                EndpointBuilder         = cosmosDbConfig._endpointBuilder,
                AuthKeyBuilder          = cosmosDbConfig._authKeyBuilder,
                ContainerBuilder        = cosmosDbConfig._containerBuilder,
                DatabaseBuilder         = cosmosDbConfig._databaseBuilder,
                ConnectionPolicyBuilder = cosmosDbConfig._connectionPolicyBuilder,
                DocumentClient          = cosmosDbConfig._documentClient
            };
            return(new CreationPolicyConfigurator());
        }