public IEnumerable <T> Find <T>(IDomainQuery <T> query) { using (this) { return(query.Execute(Context)); } }
void ApplyQueryStrategies <TResult>(IDomainQuery <TResult> query) { if (Container == null || Reflection == null) { return; } var strategiesToApply = query .GetType() .GetInterfaces() .Select(x => typeof(IQueryStrategy <>).MakeGenericType(x)) .Select(strategyType => Container.ResolveAll(strategyType)) .Where(strategies => strategies != null); foreach (var strategySet in strategiesToApply) { foreach (var strategy in strategySet) { try { var invoker = Reflection.GetInvoker(strategy, "Apply", query); invoker(); } finally { Container.Release(strategy); } } } }
public IQueryable <ENTITY> Query <ENTITY>(IDomainQuery <ENTITY> whereQuery) where ENTITY : DomainEntity { return(_unitOfWork.CurrentSession.Linq <ENTITY>().Where(whereQuery.Expression)); }
public IQueryable <TEntity> Query <TEntity>(IDomainQuery <TEntity> whereQuery) where TEntity : PersistentObject { return(_unitOfWork.CurrentSession.Query <TEntity>().Where(whereQuery.Expression)); }
public IQueryable <TEntity> Query <TEntity>(IDomainQuery <TEntity> query) where TEntity : class { return(query.Apply(_unitOfWork.CurrentSession.Linq <TEntity>())); }
public Task <TResponse> Dispatch <TResponse>(IDomainQuery <TResponse> query) { return(_mediator.Send(query)); }
public TResult Query <TResult>(IDomainQuery <TResult> query) { ApplyQueryStrategies(query); return(query.Execute(_unitOfWork.CurrentSession)); }
public TResult Query <TResult>(IDomainQuery <TResult> query) { return(query.Execute(_session)); }
public User(IDomainQuery domainQuery) { _domainQuery = domainQuery ?? throw new ArgumentNullException(nameof(domainQuery)); }
public EntityFactory(IDomainQuery domainQuery) { _domainQuery = domainQuery ?? throw new ArgumentNullException(nameof(domainQuery)); }
public Task <TResponse> ExecuteAsync <TResponse>(IDomainQuery <TResponse> query, CancellationToken cancellationToken = default) { this.logger.LogDebug("Executing query {@query}", query); return(this.mediator.Send(query, cancellationToken)); }
public static Task <TResponse> Execute <TResponse>(IDomainQuery <TResponse> query) { return(Factory().Dispatch(query)); }
private static User GetTestUser(IDomainQuery domainQuery = null) { return(new User(domainQuery ?? new Mock <IDomainQuery>().Object)); }