예제 #1
0
 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));
 }
예제 #4
0
 public IQueryable <TEntity> Query <TEntity>(IDomainQuery <TEntity> whereQuery) where TEntity : PersistentObject
 {
     return(_unitOfWork.CurrentSession.Query <TEntity>().Where(whereQuery.Expression));
 }
예제 #5
0
 public IQueryable <TEntity> Query <TEntity>(IDomainQuery <TEntity> query) where TEntity : class
 {
     return(query.Apply(_unitOfWork.CurrentSession.Linq <TEntity>()));
 }
예제 #6
0
 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));
        }
예제 #8
0
 public TResult Query <TResult>(IDomainQuery <TResult> query)
 {
     return(query.Execute(_session));
 }
예제 #9
0
 public User(IDomainQuery domainQuery)
 {
     _domainQuery = domainQuery ?? throw new ArgumentNullException(nameof(domainQuery));
 }
예제 #10
0
 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));
 }
예제 #12
0
 public static Task <TResponse> Execute <TResponse>(IDomainQuery <TResponse> query)
 {
     return(Factory().Dispatch(query));
 }
예제 #13
0
 private static User GetTestUser(IDomainQuery domainQuery = null)
 {
     return(new User(domainQuery ?? new Mock <IDomainQuery>().Object));
 }