示例#1
0
        public static SelectQuery BuildSelectQuery(ExpressionMetadataChain expressionMetadataChain)
        {
            if (expressionMetadataChain.IsEmpty())
            {
                var defaultConfig = GenerateModelQueryBuildConfig(expressionMetadataChain.LastValueType);
                return(defaultConfig.SelectQuery);
            }

            var modelType = expressionMetadataChain.GetModelType();
            var config    = GenerateModelQueryBuildConfig(modelType);

            expressionMetadataChain.Items.TakeWhile(x => ApplyExpressionChainItemOnSelectQuery(x, config)).ToList();
            OptimizeFilters(config.SelectQuery.Filters);
            return(config.SelectQuery);
        }
        private List <BaseModel> LoadModelCollection(List <Dictionary <string, object> > dataCollection, ExpressionMetadataChain chain)
        {
            var method = RepositoryReflectionUtilities.GetGenericMethod(GetType(),
                                                                        "LoadTypedModelCollection", chain.GetModelType());
            var models = (List <BaseModel>)method?.Invoke(this, new object[] { dataCollection });

            return(models);
        }