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)); }
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))); }
public IRequestValidator <TRequest> TryCreate <TRequest>() { try { return(_provider .GetProvider() .ProvideInstance <IRequestValidator <TRequest> >()); } catch (FailedToCreateServiceException) { return(null); } }
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)); } }
public InMemoryContext(ServiceProviderContainer container) { _provider = container.GetProvider(); }