Пример #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);
        }