コード例 #1
0
        private object TranslateInternal(LinqExpression expression)
        {
            Visit(expression); //ensure criteria

            var visitor = new RootVisitor(rootCriteria, session, true);
            visitor.Visit(expression);
            return visitor.Results;
        }
コード例 #2
0
        private object TranslateInternal(LinqExpression expression)
        {
            Visit(expression);             //ensure criteria

            var visitor = new RootVisitor(rootCriteria, session, true);

            visitor.Visit(expression);
            return(visitor.Results);
        }
コード例 #3
0
		public virtual object Translate(LinqExpression expression, QueryOptions queryOptions)
		{
			this.rootCriteria = null;
			this.options = queryOptions;

			Visit(expression); //ensure criteria

			var visitor = new RootVisitor(rootCriteria, session, true);
			visitor.Visit(expression);
			return visitor.Results;
		}
コード例 #4
0
        private object TranslateInternal(LinqExpression expression)
        {
            try
            {
                Visit(expression); //ensure criteria

                var visitor = new RootVisitor(rootCriteria, session, true);
                visitor.Visit(expression);

                if (_Log.IsDebugEnabled)
                    _Log.DebugFormat("Translated Criteria: {0}", rootCriteria.ToString());

                return visitor.Results;
            }
            catch (Exception ex)
            {
                var tmp = rootCriteria != null ? rootCriteria.ToString() : "{null}";
                _Log.ErrorFormat("Linq translation failed, current criteria: {0}", tmp);
                throw;
            }
        }
コード例 #5
0
        protected override Expression VisitMethodCall(MethodCallExpression expr)
        {
            Type = BinaryCriterionType.Criteria;

            //TODO: don't hardcode this alias 'sub'
            Criteria = DetachedCriteria.ForEntityName(rootCriteria.GetEntityOrClassName(), "sub");

            EntityExpression rootEntity = EntityExpressionVisitor.RootEntity(expr);

            if (rootEntity != null)
            {
                string identifierName = rootEntity.MetaData.IdentifierPropertyName;
                Criteria.Add(Restrictions.EqProperty(rootCriteria.Alias + "." + identifierName, "sub." + identifierName));
            }

            var visitor = new RootVisitor(Criteria.Adapt(session), session, false);

            visitor.Visit(expr);

            return(expr);
        }
コード例 #6
0
        protected override Expression VisitMethodCall(MethodCallExpression expr)
        {
            Type = BinaryCriterionType.Criteria;

            //TODO: don't hardcode this alias 'sub'
            Criteria = DetachedCriteria.ForEntityName(rootCriteria.GetEntityOrClassName(), "sub");

            EntityExpression rootEntity = EntityExpressionVisitor.RootEntity(expr);
            if (rootEntity != null)
            {
                string identifierName = rootEntity.MetaData.IdentifierPropertyName;
                Criteria.Add(Restrictions.EqProperty(rootCriteria.Alias + "." + identifierName, "sub." + identifierName));
            }

            var visitor = new RootVisitor(Criteria.Adapt(session), session, false);
            visitor.Visit(expr);

            return expr;
        }