public static List <CodeFile> GetCodeFiles() { List <DynamicTypeEntity> types = GetTypes(); var alreadyTranslatedExpressions = GetAlreadyTranslatedExpressions?.Invoke(); var result = new List <CodeFile>(); var entities = types.Select(dt => { var def = dt.GetDefinition(); var dcg = new DynamicTypeCodeGenerator(DynamicCode.CodeGenEntitiesNamespace, dt.TypeName, dt.BaseType, def, DynamicCode.Namespaces); var content = dcg.GetFileCode(); return(new CodeFile { FileName = dt.TypeName + ".cs", FileContent = content }); }).ToList(); result.AddRange(entities); var logics = types.Select(dt => { var def = dt.GetDefinition(); var dlg = new DynamicTypeLogicGenerator(DynamicCode.CodeGenEntitiesNamespace, dt.TypeName, dt.BaseType, def, DynamicCode.Namespaces) { AlreadyTranslated = alreadyTranslatedExpressions?.TryGetC(dt.TypeName + "Entity"), }; var content = dlg.GetFileCode(); return(new CodeFile { FileName = dt.TypeName + "Logic.cs", FileContent = content }); }).ToList(); result.AddRange(logics); var bs = new DynamicBeforeSchemaGenerator(DynamicCode.CodeGenEntitiesNamespace, types.Select(a => a.GetDefinition().CustomBeforeSchema).NotNull().ToList(), DynamicCode.Namespaces); result.Add(new CodeFile { FileName = "CodeGenBeforeSchema.cs", FileContent = bs.GetFileCode() }); return(result); }
public static string GetPropertyType(DynamicProperty property) { var generator = new DynamicTypeCodeGenerator(DynamicCode.CodeGenEntitiesNamespace, null, DynamicBaseType.Entity, null, new HashSet <string>()); return(generator.GetPropertyType(property)); }