public void GeneratePocos(CDBM db, CSharpProject p, CUsing NamespaceName, TextWriter mensajes) { foreach (CTableM t in db.lTable) { p.AddCSharpFile(PocoName(t.Name), NamespaceName); CClass c = p.AddClass(PocoName(t.Name)); c.lUsing.Add(CSharpStandarUsing.System); CConstructor consVacio = new CConstructor(c, CSharpVisibility.cvPublic); CConstructor cons = new CConstructor(c, CSharpVisibility.cvPublic); //Se añaden al final por estética de la clase generada foreach (CFieldM f in t.lFieldAll) { CType aux = CGenerator.SqlServerTD2CSharp(f.Td, f.IsNullable); if (aux.Equals(CSharpPrimitiveType.cDateTime)) { c.lUsing.Add(CSharpStandarUsing.System); } c.AddField(new CField(f.Name, aux, CSharpVisibility.cvPublic)); cons.AddParam(SUtil.LowerFirst(f.Name), CGenerator.SqlServerTD2CSharp(f.Td, f.IsNullable)); cons.AddSentence(new CTextualSentence($"this.{f.Name} = {SUtil.LowerFirst(f.Name)};")); } c.AddConstructor(consVacio); c.AddConstructor(cons); } mensajes.WriteLine("Pocos generados en: " + p.RootDirectory.ActualDirectory.FullName); }