コード例 #1
0
        public object TranslateExpression(Expression expression)
        {
            if (_Log.IsDebugEnabled)
                _Log.DebugFormat("Translating expression: {0}", expression);

            expression = Evaluator.PartialEval(expression);
            expression = new BinaryBooleanReducer().Visit(expression);

            var addedAlias = new Dictionary<string, IList<string>>();
            expression = new AssociationVisitor((ISessionFactoryImplementor)session.SessionFactory, addedAlias).Visit(expression);

            expression = new InheritanceVisitor().Visit(expression);
            expression = CollectionAliasVisitor.AssignCollectionAccessAliases(expression);
            expression = new PropertyToMethodVisitor().Visit(expression);
            expression = new BinaryExpressionOrderer().Visit(expression);

            if (_Log.IsDebugEnabled)
                _Log.DebugFormat("Optimized expression: {0}", expression);

            var translator = new NHibernateQueryTranslator(session, entityName);

            return this.rootCriteria == null ?
                translator.Translate(expression, this.queryOptions) :
                translator.Translate(expression, (ICriteria)this.rootCriteria.Clone());
        }
コード例 #2
0
		public object TranslateExpression(Expression expression)
		{
			expression = Evaluator.PartialEval(expression);
			expression = new BinaryBooleanReducer().Visit(expression);
			expression = new AssociationVisitor((ISessionFactoryImplementor)_session.SessionFactory).Visit(expression);
			expression = new InheritanceVisitor().Visit(expression);
			expression = CollectionAliasVisitor.AssignCollectionAccessAliases(expression);
			expression = new PropertyToMethodVisitor().Visit(expression);
			expression = new BinaryExpressionOrderer().Visit(expression);

			NHibernateQueryTranslator translator = new NHibernateQueryTranslator(_session,entityName);
			return translator.Translate(expression, this.queryOptions);
		}
コード例 #3
0
ファイル: MedisysQueryProvider.cs プロジェクト: VKeCRM/V2
        public object TranslateExpression(Expression expression, bool isExecute)
        {
            expression = Evaluator.PartialEval(expression);
            expression = new BinaryBooleanReducer().Visit(expression);
            expression = new AssociationVisitor((ISessionFactoryImplementor)_session.SessionFactory).Visit(expression);
            expression = new InheritanceVisitor().Visit(expression);
            expression = CollectionAliasVisitor.AssignCollectionAccessAliases(expression);
            expression = new PropertyToMethodVisitor().Visit(expression);
            expression = new BinaryExpressionOrderer().Visit(expression);

            QueryTranslator translator = new QueryTranslator(_session, entityName);
            this.rootCriteria = null;
            rootCriteria = translator.Translate(expression, this.queryOptions);

            VKeCRMRootVisitor visitor = new VKeCRMRootVisitor(rootCriteria, _session, true);
            visitor.Visit(expression);
            if (!isExecute)
            {
                return rootCriteria;
            }
            return visitor.Results;
        }