public override String Serialize(Schema schema) { StringBuilder sb = new StringBuilder(); SerializeUsings(sb, SerializationType); sb.AppendLine(""); sb.AppendLine($"namespace {NameSpace}"); sb.AppendLine("{"); if (DoSerializeModel) { ModelSerializer.SerializeTables(schema, sb); } sb.AppendLine(""); if (DoSerializeDbContext) { DBContextSerializer.SerializeDbContext(schema, ContextName, sb); } sb.AppendLine("}"); return(sb.ToString()); }
public IList <string> GetUsings(ElementToGenerateEnum mode) { IList <string> usingsFromModelSerializer = new List <string>(); IList <string> usingsFromDBContextSerializer = new List <string>(); if (DoSerializeModel) { usingsFromModelSerializer = ModelSerializer.GetUsings(); } if (DoSerializeDbContext) { usingsFromDBContextSerializer = DBContextSerializer.GetUsings(); } List <string> resultUsings = usingsFromModelSerializer.Union(usingsFromDBContextSerializer).ToList(); resultUsings.Sort(); resultUsings.Reverse(); return(resultUsings); }