static ExpressionProcessor()
        {
            _simpleExpressionCreators = new Dictionary <ExpressionType, Func <string, object, ICriterion> >();
            _simpleExpressionCreators[ExpressionType.Equal]              = Eq;
            _simpleExpressionCreators[ExpressionType.NotEqual]           = Ne;
            _simpleExpressionCreators[ExpressionType.GreaterThan]        = Gt;
            _simpleExpressionCreators[ExpressionType.GreaterThanOrEqual] = Ge;
            _simpleExpressionCreators[ExpressionType.LessThan]           = Lt;
            _simpleExpressionCreators[ExpressionType.LessThanOrEqual]    = Le;

            _propertyExpressionCreators = new Dictionary <ExpressionType, Func <string, string, ICriterion> >();
            _propertyExpressionCreators[ExpressionType.Equal]              = Restrictions.EqProperty;
            _propertyExpressionCreators[ExpressionType.NotEqual]           = Restrictions.NotEqProperty;
            _propertyExpressionCreators[ExpressionType.GreaterThan]        = Restrictions.GtProperty;
            _propertyExpressionCreators[ExpressionType.GreaterThanOrEqual] = Restrictions.GeProperty;
            _propertyExpressionCreators[ExpressionType.LessThan]           = Restrictions.LtProperty;
            _propertyExpressionCreators[ExpressionType.LessThanOrEqual]    = Restrictions.LeProperty;

            _subqueryExpressionCreatorTypes = new Dictionary <LambdaSubqueryType, IDictionary <ExpressionType, Func <string, DetachedCriteria, AbstractCriterion> > >();
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact] = new Dictionary <ExpressionType, Func <string, DetachedCriteria, AbstractCriterion> >();
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All]   = new Dictionary <ExpressionType, Func <string, DetachedCriteria, AbstractCriterion> >();
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Some]  = new Dictionary <ExpressionType, Func <string, DetachedCriteria, AbstractCriterion> >();

            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.Equal]              = Subqueries.PropertyEq;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.NotEqual]           = Subqueries.PropertyNe;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.GreaterThan]        = Subqueries.PropertyGt;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.GreaterThanOrEqual] = Subqueries.PropertyGe;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.LessThan]           = Subqueries.PropertyLt;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.LessThanOrEqual]    = Subqueries.PropertyLe;

            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All][ExpressionType.Equal]              = Subqueries.PropertyEqAll;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All][ExpressionType.GreaterThan]        = Subqueries.PropertyGtAll;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All][ExpressionType.GreaterThanOrEqual] = Subqueries.PropertyGeAll;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All][ExpressionType.LessThan]           = Subqueries.PropertyLtAll;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All][ExpressionType.LessThanOrEqual]    = Subqueries.PropertyLeAll;

            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Some][ExpressionType.GreaterThan]        = Subqueries.PropertyGtSome;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Some][ExpressionType.GreaterThanOrEqual] = Subqueries.PropertyGeSome;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Some][ExpressionType.LessThan]           = Subqueries.PropertyLtSome;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Some][ExpressionType.LessThanOrEqual]    = Subqueries.PropertyLeSome;

            _customMethodCallProcessors = new Dictionary <string, Func <MethodCallExpression, ICriterion> >();
            RegisterCustomMethodCall(() => RestrictionExtensions.IsLike("", ""), RestrictionExtensions.ProcessIsLike);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsLike("", "", null), RestrictionExtensions.ProcessIsLikeMatchMode);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsLike("", "", null, null), RestrictionExtensions.ProcessIsLikeMatchModeEscapeChar);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsInsensitiveLike("", ""), RestrictionExtensions.ProcessIsInsensitiveLike);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsInsensitiveLike("", "", null), RestrictionExtensions.ProcessIsInsensitiveLikeMatchMode);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsIn(null, new object[0]), RestrictionExtensions.ProcessIsInArray);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsIn(null, new List <object>()), RestrictionExtensions.ProcessIsInCollection);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsBetween(null, null).And(null), RestrictionExtensions.ProcessIsBetween);
        }
        static ExpressionProcessor()
        {
            _simpleExpressionCreators = new Dictionary <ExpressionType, Func <ProjectionInfo, object, ICriterion> >();
            _simpleExpressionCreators[ExpressionType.Equal]              = Eq;
            _simpleExpressionCreators[ExpressionType.NotEqual]           = Ne;
            _simpleExpressionCreators[ExpressionType.GreaterThan]        = Gt;
            _simpleExpressionCreators[ExpressionType.GreaterThanOrEqual] = Ge;
            _simpleExpressionCreators[ExpressionType.LessThan]           = Lt;
            _simpleExpressionCreators[ExpressionType.LessThanOrEqual]    = Le;

            _propertyExpressionCreators = new Dictionary <ExpressionType, Func <ProjectionInfo, ProjectionInfo, ICriterion> >();
            _propertyExpressionCreators[ExpressionType.Equal]              = (lhs, rhs) => lhs.CreateCriterion(rhs, Restrictions.EqProperty, Restrictions.EqProperty, Restrictions.EqProperty, Restrictions.EqProperty);
            _propertyExpressionCreators[ExpressionType.NotEqual]           = (lhs, rhs) => lhs.CreateCriterion(rhs, Restrictions.NotEqProperty, Restrictions.NotEqProperty, Restrictions.NotEqProperty, Restrictions.NotEqProperty);
            _propertyExpressionCreators[ExpressionType.GreaterThan]        = (lhs, rhs) => lhs.CreateCriterion(rhs, Restrictions.GtProperty, Restrictions.GtProperty, Restrictions.GtProperty, Restrictions.GtProperty);
            _propertyExpressionCreators[ExpressionType.GreaterThanOrEqual] = (lhs, rhs) => lhs.CreateCriterion(rhs, Restrictions.GeProperty, Restrictions.GeProperty, Restrictions.GeProperty, Restrictions.GeProperty);
            _propertyExpressionCreators[ExpressionType.LessThan]           = (lhs, rhs) => lhs.CreateCriterion(rhs, Restrictions.LtProperty, Restrictions.LtProperty, Restrictions.LtProperty, Restrictions.LtProperty);
            _propertyExpressionCreators[ExpressionType.LessThanOrEqual]    = (lhs, rhs) => lhs.CreateCriterion(rhs, Restrictions.LeProperty, Restrictions.LeProperty, Restrictions.LeProperty, Restrictions.LeProperty);

            _subqueryExpressionCreatorTypes = new Dictionary <LambdaSubqueryType, IDictionary <ExpressionType, Func <string, DetachedCriteria, AbstractCriterion> > >();
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact] = new Dictionary <ExpressionType, Func <string, DetachedCriteria, AbstractCriterion> >();
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All]   = new Dictionary <ExpressionType, Func <string, DetachedCriteria, AbstractCriterion> >();
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Some]  = new Dictionary <ExpressionType, Func <string, DetachedCriteria, AbstractCriterion> >();

            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.Equal]              = Subqueries.PropertyEq;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.NotEqual]           = Subqueries.PropertyNe;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.GreaterThan]        = Subqueries.PropertyGt;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.GreaterThanOrEqual] = Subqueries.PropertyGe;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.LessThan]           = Subqueries.PropertyLt;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Exact][ExpressionType.LessThanOrEqual]    = Subqueries.PropertyLe;

            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All][ExpressionType.Equal]              = Subqueries.PropertyEqAll;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All][ExpressionType.GreaterThan]        = Subqueries.PropertyGtAll;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All][ExpressionType.GreaterThanOrEqual] = Subqueries.PropertyGeAll;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All][ExpressionType.LessThan]           = Subqueries.PropertyLtAll;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.All][ExpressionType.LessThanOrEqual]    = Subqueries.PropertyLeAll;

            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Some][ExpressionType.GreaterThan]        = Subqueries.PropertyGtSome;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Some][ExpressionType.GreaterThanOrEqual] = Subqueries.PropertyGeSome;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Some][ExpressionType.LessThan]           = Subqueries.PropertyLtSome;
            _subqueryExpressionCreatorTypes[LambdaSubqueryType.Some][ExpressionType.LessThanOrEqual]    = Subqueries.PropertyLeSome;

            _customMethodCallProcessors = new Dictionary <string, Func <MethodCallExpression, ICriterion> >();
            RegisterCustomMethodCall(() => RestrictionExtensions.IsLike("", ""), RestrictionExtensions.ProcessIsLike);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsLike("", "", null), RestrictionExtensions.ProcessIsLikeMatchMode);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsLike("", "", null, null), RestrictionExtensions.ProcessIsLikeMatchModeEscapeChar);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsInsensitiveLike("", ""), RestrictionExtensions.ProcessIsInsensitiveLike);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsInsensitiveLike("", "", null), RestrictionExtensions.ProcessIsInsensitiveLikeMatchMode);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsIn(null, Array.Empty <object>()), RestrictionExtensions.ProcessIsInArray);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsIn(null, new List <object>()), RestrictionExtensions.ProcessIsInCollection);
            RegisterCustomMethodCall(() => RestrictionExtensions.IsBetween(null, null).And(null), RestrictionExtensions.ProcessIsBetween);

            _customProjectionProcessors = new Dictionary <string, Func <Expression, IProjection> >();
            RegisterCustomProjection(() => default(DateTime).Year, e => ProjectionsExtensions.ProcessYear(e.Expression));
            RegisterCustomProjection(() => default(DateTime).Day, e => ProjectionsExtensions.ProcessDay(e.Expression));
            RegisterCustomProjection(() => default(DateTime).Month, e => ProjectionsExtensions.ProcessMonth(e.Expression));
            RegisterCustomProjection(() => default(DateTime).Hour, e => ProjectionsExtensions.ProcessHour(e.Expression));
            RegisterCustomProjection(() => default(DateTime).Minute, e => ProjectionsExtensions.ProcessMinute(e.Expression));
            RegisterCustomProjection(() => default(DateTime).Second, e => ProjectionsExtensions.ProcessSecond(e.Expression));
            RegisterCustomProjection(() => default(DateTime).Date, e => ProjectionsExtensions.ProcessDate(e.Expression));

            RegisterCustomProjection(() => default(DateTimeOffset).Year, e => ProjectionsExtensions.ProcessYear(e.Expression));
            RegisterCustomProjection(() => default(DateTimeOffset).Day, e => ProjectionsExtensions.ProcessDay(e.Expression));
            RegisterCustomProjection(() => default(DateTimeOffset).Month, e => ProjectionsExtensions.ProcessMonth(e.Expression));
            RegisterCustomProjection(() => default(DateTimeOffset).Hour, e => ProjectionsExtensions.ProcessHour(e.Expression));
            RegisterCustomProjection(() => default(DateTimeOffset).Minute, e => ProjectionsExtensions.ProcessMinute(e.Expression));
            RegisterCustomProjection(() => default(DateTimeOffset).Second, e => ProjectionsExtensions.ProcessSecond(e.Expression));
            RegisterCustomProjection(() => default(DateTimeOffset).Date, e => ProjectionsExtensions.ProcessDate(e.Expression));

            RegisterCustomProjection(() => ProjectionsExtensions.Sqrt(default(int)), ProjectionsExtensions.ProcessSqrt);
            RegisterCustomProjection(() => ProjectionsExtensions.Sqrt(default(double)), ProjectionsExtensions.ProcessSqrt);
            RegisterCustomProjection(() => ProjectionsExtensions.Sqrt(default(decimal)), ProjectionsExtensions.ProcessSqrt);
            RegisterCustomProjection(() => ProjectionsExtensions.Sqrt(default(byte)), ProjectionsExtensions.ProcessSqrt);
            RegisterCustomProjection(() => ProjectionsExtensions.Sqrt(default(long)), ProjectionsExtensions.ProcessSqrt);
            RegisterCustomProjection(() => ProjectionsExtensions.Lower(string.Empty), ProjectionsExtensions.ProcessLower);
            RegisterCustomProjection(() => ProjectionsExtensions.Upper(string.Empty), ProjectionsExtensions.ProcessUpper);
            RegisterCustomProjection(() => ProjectionsExtensions.TrimStr(string.Empty), ProjectionsExtensions.ProcessTrimStr);
            RegisterCustomProjection(() => ProjectionsExtensions.StrLength(string.Empty), ProjectionsExtensions.ProcessStrLength);
            RegisterCustomProjection(() => ProjectionsExtensions.BitLength(string.Empty), ProjectionsExtensions.ProcessBitLength);
            RegisterCustomProjection(() => ProjectionsExtensions.Substr(string.Empty, 0, 0), ProjectionsExtensions.ProcessSubstr);
            RegisterCustomProjection(() => ProjectionsExtensions.CharIndex(string.Empty, string.Empty, 0), ProjectionsExtensions.ProcessCharIndex);
            RegisterCustomProjection(() => ProjectionsExtensions.Coalesce <DBNull>(null, null), ProjectionsExtensions.ProcessCoalesce);
            RegisterCustomProjection(() => ProjectionsExtensions.Coalesce <int>(null, 0), ProjectionsExtensions.ProcessCoalesce);
            RegisterCustomProjection(() => Projections.Concat(null), Projections.ProcessConcat);
            RegisterCustomProjection(() => ProjectionsExtensions.Mod(0, 0), ProjectionsExtensions.ProcessMod);
            RegisterCustomProjection(() => ProjectionsExtensions.Abs(default(int)), ProjectionsExtensions.ProcessIntAbs);
            RegisterCustomProjection(() => ProjectionsExtensions.Abs(default(double)), ProjectionsExtensions.ProcessDoubleAbs);
            RegisterCustomProjection(() => ProjectionsExtensions.Abs(default(Int64)), ProjectionsExtensions.ProcessInt64Abs);

            RegisterCustomProjection(() => Math.Round(default(double)), ProjectionsExtensions.ProcessRound);
            RegisterCustomProjection(() => Math.Round(default(decimal)), ProjectionsExtensions.ProcessRound);
            RegisterCustomProjection(() => Math.Round(default(double), default(int)), ProjectionsExtensions.ProcessRound);
            RegisterCustomProjection(() => Math.Round(default(decimal), default(int)), ProjectionsExtensions.ProcessRound);
            RegisterCustomProjection(() => ProjectionsExtensions.AsEntity(default(object)), ProjectionsExtensions.ProcessAsEntity);
        }