예제 #1
0
            private static Func <IEnumerable <ClassProperty> > GetFunc()
            {
                var body = Expression.Constant(DataEntityExtension.GetProperties <TEntity>());

                return(Expression
                       .Lambda <Func <IEnumerable <ClassProperty> > >(body)
                       .Compile());
            }
예제 #2
0
        /// <summary>
        /// Gets a function used to extract the properties of a class.
        /// </summary>
        /// <typeparam name="T">The target type.</typeparam>
        /// <returns>The properties of the class.</returns>
        private static Func <IEnumerable <ClassProperty> > GetCompiledFunctionForClassPropertiesExtractor <T>()
            where T : class
        {
            // Variables type (Command.None is preloaded everywhere)
            var properties = DataEntityExtension.GetProperties <T>();

            // Set the body
            var body = Expression.Constant(properties);

            // Set the function value
            return(Expression
                   .Lambda <Func <IEnumerable <ClassProperty> > >(body)
                   .Compile());
        }