예제 #1
0
        public static IWhereFragment[] Flatten(this IWhereFragment fragment)
        {
            if (fragment == null)
            {
                return(new IWhereFragment[0]);
            }

            if (fragment is CompoundWhereFragment)
            {
                return(fragment.As <CompoundWhereFragment>().Children.ToArray());
            }

            return(new IWhereFragment[] { fragment });
        }
예제 #2
0
        public static IWhereFragment Append(this IWhereFragment fragment, IWhereFragment other)
        {
            if (fragment is CompoundWhereFragment)
            {
                fragment.As <CompoundWhereFragment>().Add(other);
                return(fragment);
            }
            else if (other is CompoundWhereFragment)
            {
                other.As <CompoundWhereFragment>().Add(fragment);
                return(other);
            }

            return(new CompoundWhereFragment("and", fragment, other));
        }