コード例 #1
0
        public virtual async Task <string> CreateEventSubscription(EventSubscription subscription)
        {
            subscription.Id = _guidGenerator.Create().ToString();
            var persistable = subscription.ToPersistable();
            await _eventSubscriptionRepository.InsertAsync(persistable);

            return(subscription.Id);
        }
コード例 #2
0
        public async Task <string> CreateEventSubscription(EventSubscription subscription)
        {
            subscription.Id = Guid.NewGuid().ToString();
            var persistable = subscription.ToPersistable();
            var result      = Set <PersistedSubscription>().Add(persistable);

            SaveChanges();
            Entry(persistable).State = EntityState.Detached;
            return(subscription.Id);
        }
コード例 #3
0
        public async Task <string> CreateEventSubscription(EventSubscription subscription)
        {
            using (var db = ConstructDbContext())
            {
                subscription.Id = Guid.NewGuid().ToString();
                var persistable = subscription.ToPersistable();
                var result      = db.Set <PersistedSubscription>().Add(persistable);
                await db.SaveChangesAsync();

                return(subscription.Id);
            }
        }
コード例 #4
0
        public async Task <string> CreateEventSubscription(EventSubscription subscription)
        {
            _mutex.WaitOne();
            try
            {
                subscription.Id = Guid.NewGuid().ToString();
                var persistable = subscription.ToPersistable();
                var result      = Set <PersistedSubscription>().Add(persistable);
                await SaveChangesAsync();

                Entry(persistable).State = EntityState.Detached;
                return(subscription.Id);
            }
            finally
            {
                _mutex.Set();
            }
        }