Exemple #1
0
        public static string CanOrder(QueryToken token)
        {
            if (token == null)
            {
                return("No column selected");
            }

            if (token.Type.IsEmbeddedEntity() && !OrderAdapters.ContainsKey(token.Type))
            {
                return("{0} can not be ordered".FormatWith(token.Type.NicePluralName()));
            }

            if (QueryToken.IsCollection(token.Type))
            {
                return("Collections can not be ordered");
            }

            if (token.HasAllOrAny())
            {
                return("'{0}', '{1}', '{2}' or '{3}' can not be ordered".FormatWith(
                           CollectionAnyAllType.All.NiceToString(),
                           CollectionAnyAllType.Any.NiceToString(),
                           CollectionAnyAllType.NoOne.NiceToString(),
                           CollectionAnyAllType.AnyNo.NiceToString()));
            }

            return(null);
        }
Exemple #2
0
        public static string CanOrder(QueryToken token)
        {
            if (token == null)
            {
                return("No column selected");
            }

            if (token.Type.IsEmbeddedEntity())
            {
                return("{0} can not be ordered".FormatWith(token.Type.NicePluralName()));
            }

            if (token.HasAllOrAny())
            {
                return("Columns can not contain '{0}', '{1}', {2} or {3}".FormatWith(
                           CollectionElementType.All.NiceToString(),
                           CollectionElementType.Any.NiceToString(),
                           CollectionElementType.NoOne.NiceToString(),
                           CollectionElementType.AnyNo.NiceToString()));
            }

            return(null);
        }
Exemple #3
0
        public static string CanColumn(QueryToken token)
        {
            if (token == null)
            {
                return("No column selected");
            }

            if (token.Type != typeof(string) && token.Type != typeof(byte[]) && token.Type.ElementType() != null)
            {
                return("You can not add collections as columns");
            }

            if (token.HasAllOrAny())
            {
                return("Columns can not contain '{0}', '{1}', {2} or {3}".FormatWith(
                           CollectionElementType.All.NiceToString(),
                           CollectionElementType.Any.NiceToString(),
                           CollectionElementType.NoOne.NiceToString(),
                           CollectionElementType.AnyNo.NiceToString()));
            }

            return(null);
        }