/// <summary>
 /// For internal use only.
 /// </summary>
 /// <param name="cacheQueryOptions"></param>
 /// <param name="entityManagerParameterExpr"></param>
 private CacheQueryExpressionVisitor(EntityQuery query, CacheQueryOptions cacheQueryOptions)
     : base()
 {
     _query                      = query;
     _cacheQueryOptions          = cacheQueryOptions;
     _entityManagerParameterExpr = Expression.Parameter(typeof(EntityManager));
 }
 public static bool NotEquals(String s1, String s2, CacheQueryOptions cqo)
 {
     if (cqo.UseSql92CompliantStringComparison)
     {
         s1 = (s1 ?? "").TrimEnd();
         s2 = (s2 ?? "").TrimEnd();
     }
     return(!String.Equals(s1, s2, cqo.StringComparison));
 }
        /// <summary>
        /// See <see cref="Object.Equals(Object)"/>.
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public override bool Equals(Object o)
        {
            if (o == null)
            {
                return(false);
            }
            CacheQueryOptions cqo = o as CacheQueryOptions;

            if (cqo == null)
            {
                return(false);
            }
            return(cqo.StringComparison == this.StringComparison &&
                   cqo.UseSql92CompliantStringComparison == this.UseSql92CompliantStringComparison &&
                   cqo.GuidOrdering == this.GuidOrdering);
        }
 public static int IndexOf(String s1, String s2, CacheQueryOptions cqo)
 {
     return(s1.IndexOf(s2, cqo.StringComparison));
 }
 public static bool Contains(String s1, String s2, CacheQueryOptions cqo)
 {
     return(s1.IndexOf(s2, cqo.StringComparison) >= 0);
 }
 public static bool EndsWith(String s1, String s2, CacheQueryOptions cqo)
 {
     return(s1.EndsWith(s2, cqo.StringComparison));
 }
        public static Expression <Func <EntityManager, IEnumerable> > Visit(EntityQuery query, CacheQueryOptions cacheQueryOptions)
        {
            var visitor = new CacheQueryExpressionVisitor(query, cacheQueryOptions);

            return(visitor.VisitRoot(query.Expression));
        }
 static CacheQueryOptions()
 {
     // same as DefaultSqlServerCompatibility.
     // __default = new CacheQueryOptions(StringComparison.OrdinalIgnoreCase, true, GuidOrdering.SqlServer);
     __default = new CacheQueryOptions(StringComparison.CurrentCultureIgnoreCase, true, GuidOrdering.SqlServer);
 }