예제 #1
0
        public virtual EntitySet <TEntity> Set <TEntity>()
            where TEntity : class
        {
            var provider = _provider.GetProvider();

            if (DbContext == null)
            {
                DbContext = _contextFactory.FromEntityType <TEntity>(provider);
            }

            return(new EntitySet <TEntity>(new EntityFrameworkEntitySet <TEntity>(DbContext), provider));
        }
        public Task <Response <GetAllResult <TOut> > > HandleAsync(TRequest request, CancellationToken token)
        {
            var provider = _container.GetProvider();

            ApplyConfiguration(request);

            return(HandleWithErrorsAsync(request, provider, token, _HandleAsync));
        }
예제 #3
0
        public Task <Response> HandleAsync(TRequest request, CancellationToken token)
        {
            var provider = _container.GetProvider();

            ApplyConfiguration(request);

            return(HandleWithErrorsAsync(request, provider, token,
                                         (_, p, ct) => (Task)DeleteEntity(request, provider, ct)));
        }
예제 #4
0
 public IRequestValidator <TRequest> TryCreate <TRequest>()
 {
     try
     {
         return(_provider
                .GetProvider()
                .ProvideInstance <IRequestValidator <TRequest> >());
     }
     catch (FailedToCreateServiceException)
     {
         return(null);
     }
 }
예제 #5
0
        public async Task <Response> HandleAsync(TRequest request, CancellationToken token)
        {
            using (var provider = _container.GetProvider())
            {
                foreach (var requestHook in _requestConfig.GetRequestHooks(provider))
                {
                    await requestHook.Run(request, token).Configure();

                    token.ThrowIfCancellationRequested();
                }

                return(await _decorateeFactory().HandleAsync(request, token));
            }
        }
예제 #6
0
 public InMemoryContext(ServiceProviderContainer container)
 {
     _provider = container.GetProvider();
 }