public async Task <IAggregateRootSynchronizationContext> EnterAsync(Type aggregateRootType, Guid aggregateRootId) { IAggregateRootSynchronizationContext context = null; try { string key = GetKey(aggregateRootType, aggregateRootId); // get and/or add context to cache return(context = AddOrGetCacheItem(aggregateRootId, key)); } finally { // check if context was returned from cache if (context == null) { throw new ApplicationException(ErrorMessage); } // lock identity await context.LockAsync(); } }
public void Exit(IAggregateRootSynchronizationContext context) { Contract.Requires(context != null); throw new NotImplementedException(); }
public void Exit(IAggregateRootSynchronizationContext context) { // exit lock for identity context.Unlock(); }