Пример #1
0
        /// <summary>
        /// Creates a Query Expression using the specified settings.
        /// </summary>
        /// <typeparam name="T">The type of Entity to use as the base for the QueryExpression</typeparam>
        /// <param name="settings">The query settings used to create the Query Expression.</param>
        /// <returns></returns>
        public static QueryExpression Create <T>(QuerySettings <T> settings) where T : Entity
        {
            var qe = new QueryExpression()
            {
                EntityName = Extensions.GetEntityLogicalName <T>(),
                ColumnSet  = settings.Columns
            };

            qe.Criteria.FilterOperator = settings.CriteriaOperator;

            if (settings.First)
            {
                qe.First();
            }

            if (settings.ActiveOnly)
            {
                qe.ActiveOnly <T>();
            }

            if (settings.AllCustomColumns)
            {
                qe.AllCustomColumns <T>();
            }

            return(qe);
        }