internal static void GenerateDynamicListModel(CodeNamespace codeNamespace, Type contextType, Type entityType) { //Create the Dynamic class CodeTypeDeclaration genClass = codeNamespace.DefineClass(entityType, "EntityListModel"); //add base type declaration Type baseType = typeof(EntityListModel <,>).MakeGenericType(contextType, entityType); genClass.BaseTypes.Add(new CodeTypeReference(baseType)); genClass.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, "Codegen Region")); GenerateQueryProviderMember(genClass, entityType); GenerateEntryStatisEntryPoint(genClass, entityType); GenerateFilterPropertyMembers(genClass, entityType); GenerateApplyFilterMethod(genClass, entityType); genClass.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, string.Empty)); }