public linq.Expression <Func <IEvaluationContext, bool> > GetExpression()
 {
     linq.Expression <Func <IEvaluationContext, bool> > retVal = AllAny.IsAll ? PredicateBuilder.True <IEvaluationContext>() : PredicateBuilder.False <IEvaluationContext>();
     foreach (var adaptor in this.Children.OfType <IExpressionAdaptor>())
     {
         var expression = adaptor.GetExpression();
         if (!AllAny.IsAll)
         {
             retVal = retVal.Or(expression);
         }
         else
         {
             retVal = retVal.And(expression);
         }
     }
     return(retVal);
 }
        public System.Linq.Expressions.Expression <Func <IEvaluationContext, bool> > GetExpression()
        {
            linq.Expression <Func <IEvaluationContext, bool> > retVal = ((IExpressionAdaptor)this.Children[0]).GetExpression();
            foreach (var adaptor in this.Children.OfType <IExpressionAdaptor>())
            {
                var expression = adaptor.GetExpression();
                if (adaptor is PriceListAssignmentExpressionBlock)
                {
                    expression = ((PriceListAssignmentExpressionBlock)adaptor).ConditionBlock.GetExpression();
                    if (!((PriceListAssignmentExpressionBlock)adaptor).ConditionBlock.AndOr.IsAnd)
                    {
                        retVal = retVal.Or(expression);
                    }
                    else
                    {
                        retVal = retVal.And(expression);
                    }
                }
                //else
                //	retVal = retVal.And(expression);
            }

            return(retVal);
        }
Esempio n. 3
0
        /// <summary>
        /// 创建对象关系。
        /// </summary>
        /// <typeparam name="TSource">关系源类型。</typeparam>
        /// <typeparam name="TTarget">关系目标类型。</typeparam>
        /// <param name="expressions">成员表达式。</param>
        /// <returns>操作实例。</returns>
        public IEnumerable <DbMaintenanceOperateBase> CreateRelation <TSource, TTarget>(linq.Expression <Func <TSource, TTarget> > expressions)
        {
            var property = ((System.Linq.Expressions.LambdaExpression)expressions).GetMember();

            return(CreateDropRelation(typeof(TSource), property, EOperateType.CreateRelation));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DatabaseElementRepository"/> class.
 /// </summary>
 /// <param name="repositoryFactory">The repository factory.</param>
 /// <param name="cacheRepository">The cache repository.</param>
 public CachedDatabaseElementRepository(IRepositoryFactory<IAppConfigRepository> repositoryFactory, IElementRepository cacheRepository, linq.Expression<Func<Localization, bool>> baseFilter)
 {
     _repositoryFactory = repositoryFactory;
     _cacheRepository = cacheRepository;
     _baseFilter = baseFilter;
 }
        public static TResult Find <TScope, TResult>(this ExpressionScope scope, INamespace <TScope> session, linq.Expression <Func <TScope, TResult> > getItem) where TScope : INamespace
        {
            foreach (var current in scope.Enumerate())
            {
                if (current.Context.TryGetItem(session, getItem, out var value))
                {
                    return(value);
                }
            }

            return(default);
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DatabaseElementRepository"/> class.
 /// </summary>
 /// <param name="repositoryFactory">The repository factory.</param>
 /// <param name="cacheRepository">The cache repository.</param>
 public CachedDatabaseElementRepository(IRepositoryFactory <IAppConfigRepository> repositoryFactory, IElementRepository cacheRepository, linq.Expression <Func <Localization, bool> > baseFilter)
 {
     _repositoryFactory = repositoryFactory;
     _cacheRepository   = cacheRepository;
     _baseFilter        = baseFilter;
 }