Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of <see cref="EventSubscriptions"/>
        /// </summary>
        /// <param name="configuration"><see cref="EventStorageConfiguration">Configuration</see> for event storage</param>
        /// <param name="serializer"><see cref="ISerializer">Serializer</see></param>
        public EventSubscriptions(EventStorageConfiguration configuration, ISerializer serializer)
        {
            _serializer = serializer;

            Initialize(configuration);
            InitializeCollection();
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of <see cref="EventSubscriptions"/>
        /// </summary>
        /// <param name="configuration"><see cref="EventStorageConfiguration">Configuration</see> for event storage</param>
        /// <param name="serializer"><see cref="ISerializer">Serializer</see></param>
        public EventSubscriptions(EventStorageConfiguration configuration, ISerializer serializer)
        {
            _serializer = serializer;

            Initialize(configuration);
            InitializeCollection();
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes an instance of <see cref="EventStore"/>
        /// </summary>
        /// <param name="configuration"><see cref="EventStorageConfiguration">Configuration</see> for storage</param>
        /// <param name="serializer"><see cref="ISerializer">Serializer</see></param>
        public EventStore(EventStorageConfiguration configuration, ISerializer serializer)
        {
            _serializer = serializer;

            Initialize(configuration);
            InitializeCollection();

            InitializeStoredProcedures();
        }
 /// <summary>
 /// Configures events to be stored in an Azure DocumentDB
 /// </summary>
 /// <param name="eventsConfiguration"><see cref="IEventsConfiguration"/> being fluently configured</param>
 /// <param name="configureCallback"><see cref="Action{EventStorageConfiguration}">Callback</see> to get called for configuration</param>
 /// <returns></returns>
 public static IConfigure UsingDocumentDB(this IEventsConfiguration eventsConfiguration, Action<EventStorageConfiguration> configureCallback)
 {
     eventsConfiguration.EventStoreType = typeof(EventStore);
     eventsConfiguration.EventSubscriptionsType = typeof(EventSubscriptions);
     var configuration = new EventStorageConfiguration();
     configureCallback(configuration);
     Configure.Instance.Container.Bind<EventStorageConfiguration>(configuration);
     return Configure.Instance;
 }
Esempio n. 5
0
        /// <summary>
        /// Initializes an instance of <see cref="EventStore"/>
        /// </summary>
        /// <param name="configuration"><see cref="EventStorageConfiguration">Configuration</see> for storage</param>
        /// <param name="serializer"><see cref="ISerializer">Serializer</see></param>
        public EventStore(EventStorageConfiguration configuration, ISerializer serializer)
        {
            _serializer = serializer;

            Initialize(configuration);
            InitializeCollection();

            InitializeStoredProcedures();
        }
Esempio n. 6
0
        void Initialize(EventStorageConfiguration configuration)
        {
            _client = new DocumentClient(new Uri(configuration.Url), configuration.AuthorizationKey);
            _client.ReadDatabaseFeedAsync()
            .ContinueWith(a => _database = a.Result.Where(d => d.Id == configuration.DatabaseId).SingleOrDefault())
            .Wait();

            if (_database == null)
            {
                _database = new Database {
                    Id = configuration.DatabaseId
                };
                _client.CreateDatabaseAsync(_database)
                .ContinueWith(d => _database = d.Result.Resource)
                .Wait();
            }
        }
Esempio n. 7
0
        void Initialize(EventStorageConfiguration configuration)
        {
            _client = new DocumentClient(new Uri(configuration.Url), configuration.AuthorizationKey);
            _client.ReadDatabaseFeedAsync()
                .ContinueWith(a => _database = a.Result.Where(d => d.Id == configuration.DatabaseId).SingleOrDefault())
                .Wait();

            if (_database == null)
            {
                _database = new Database { Id = configuration.DatabaseId };
                _client.CreateDatabaseAsync(_database)
                    .ContinueWith(d => _database = d.Result.Resource)
                    .Wait();
            }
        }