コード例 #1
0
        public async Task AddEventAsync <TEvent>(TEvent @event)
            where TEvent : IEvent <TEventId, TAggregateId>
        {
            var persistedEvent = _eventDataFactory.Create(@event);
            await DbContext.Events.AddAsync(persistedEvent);

            await DbContext.SaveChangesAsync();
        }
コード例 #2
0
        public virtual void Register(IEvent @event, IMetaInfo metaInfo)
        {
            V data;

            //Synchronization is left here mostly in consistency with cache and process, but factories are usually not thread safe anyway.
            lock (factory) {
                data = factory.Create(@event, metaInfo);
            }
            if (data != null)
            {
                lock (cache) {
                    cache.Put(data);
                }
                TryProcessNextAsync();
            }
        }