コード例 #1
0
        private void AfterSave(IIdentity id, IRepositoryEx repositoryEx, IAggregateEx aggregate)
        {
            //store the repository on the cache, actually we are keeping the very
            //same entity that was disposed by the caller.
            var cacheEntry = new CacheEntry(repositoryEx, aggregate);

            Cache.Add(id.AsString(), cacheEntry, _cachePolicy);
        }
コード例 #2
0
 public SingleUseAggregateCachedRepository(
     IRepositoryExFactory repositoryFactory,
     IIdentity id)
 {
     _repositoryFactory = repositoryFactory;
     _wrappedRepository = _repositoryFactory.Create();
     _aggregate         = _wrappedRepository.GetById <TAggregate>(id);
 }
コード例 #3
0
ファイル: SQLDataContext.cs プロジェクト: aburyndina/Animal
        public SqlDataContext()
        {
            SqlAnimalRepository repository = new SqlAnimalRepository();

            AnimalType = repository;
            FellColor  = repository;
            Location   = repository;
            Region     = repository;
            Animals    = repository;
        }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="wrappedRepository"></param>
 /// <param name="aggregate">When aggregate is not in cache this parameter is null and the
 /// instance of the aggregate is taken from the repository. </param>
 /// <param name="disposeAction"></param>
 /// <param name="afterSaveAction"></param>
 /// <param name="onExceptionAction"></param>
 /// <param name="id"></param>
 public CachableAggregateCachedRepository(
     IRepositoryEx wrappedRepository,
     TAggregate aggregate,
     Action <IIdentity, IRepositoryEx> disposeAction,
     Action <IIdentity, IRepositoryEx, IAggregateEx> afterSaveAction,
     Action <IIdentity, IRepositoryEx> onExceptionAction,
     IIdentity id)
 {
     _wrappedRepository = wrappedRepository;
     _disposeAction     = disposeAction;
     _afterSaveAction   = afterSaveAction;
     _onExceptionAction = onExceptionAction;
     _aggregate         = aggregate ?? wrappedRepository.GetById <TAggregate>(id);
 }
コード例 #5
0
 public CacheEntry(IRepositoryEx repositoryEx, IAggregateEx aggregate)
 {
     RepositoryEx = repositoryEx;
     Aggregate    = aggregate;
 }
コード例 #6
0
 private void OnException(IIdentity id, IRepositoryEx repositoryEx)
 {
     //remove the repository from cache, this will really dispose wrapped repository
     _repositoryFactory.Release(repositoryEx);
     Cache.Remove(id.AsString());
 }
コード例 #7
0
 private void DisposeRepository(IIdentity id, IRepositoryEx repositoryEx)
 {
     //This is called when the repository is disposed.
     ReleaseAggregateId(id);
 }
コード例 #8
0
ファイル: ServiceEx.cs プロジェクト: rvegajr/ez-api-urf-net
 protected ServiceEx(IRepositoryAsync <TEntity> repository) : base(repository)
 {
     _repositoryAsync = repository as IRepositoryEx <TEntity>;
 }