public string GetTableDefinitionsCodeForEntityTypes( ITableMetaInfoBuilder tmiBldr, IEnumerable <Type> types, TDCodeGenerator codeGenOps = null, bool withNamespace = true) { if (types == null) { return(null); } Type[] arr = types.ToArray(); var codes = new List <string>(arr.Length); for (int i = 0; i < arr.Length; i++) { Type t = arr[i]; string code = tmiBldr.GetTableDefinitionCode( t, codeGenOps, withNamespace: false); // must NOT have ns! codes.Add(code); } if (!withNamespace) { return(codes.JoinToString("\r\n")); } return(codeGenOps.WrapTableDefinitionsCodeInOuterNamespaceAndUsings(codes)); }
public static string WriteTableDefinitionsCodeForAllDbSets( this DbContext[] dbContexts, TDCodeGenerator options, string pathTDsCSFile, string pathTDsOldCommentedOutCSFile = null, int maxLinesToSaveOldCommentedOutVersion = 10_000) { if (options == null) { options = new TDCodeGenerator(); } var tdCodes = new List <string>(dbContexts.Length); for (int i = 0; i < dbContexts.Length; i++) { string tdCode = GetTableDefinitionsCodeForAllDbSets(dbContexts[i], options, withNamespace: false); tdCodes.Add(tdCode); } string finalResult = options.WriteNewTableDefinitionsCode( tdCodes, pathTDsCSFile, pathTDsOldCommentedOutCSFile, maxLinesToSaveOldCommentedOutVersion); return(finalResult); }
public static string GetTableDefinitionsCodeForAllDbSets( this ITableMetaInfoBuilder tmiBldr, TDCodeGenerator codeGenOps = null, bool withNamespace = true) => GetTableDefinitionsCodeForEntityTypes( tmiBldr, tmiBldr.GetEntityTypes(), codeGenOps, withNamespace);
public static string GetTableDefinitionsCodeForAllDbSets( this DbContext dbContext, TDCodeGenerator options = null, bool withNamespace = true) { ITableMetaInfoBuilder tableMeta = dbContext.GetTableMetaInfoBuilder(); string code = tableMeta.GetTableDefinitionsCodeForAllDbSets(options, withNamespace); return(code); }
public static string GetTableDefinitionsCodeForAllDbSets( this DbContext[] dbContexts, TDCodeGenerator options = null) { var tdCodes = new List <string>(dbContexts.Length); if (options == null) { options = new TDCodeGenerator(); } for (int i = 0; i < dbContexts.Length; i++) { string tdCode = GetTableDefinitionsCodeForAllDbSets(dbContexts[i], options, withNamespace: false); tdCodes.Add(tdCode); } string code = options.WrapTableDefinitionsCodeInOuterNamespaceAndUsings(tdCodes); return(code); }
public static string GetTableDefinitionCode( this ITableMetaInfo tinfo, TDCodeGenerator codeGenOps = null, bool withNamespace = true) => codeGenOps.E().GetTableDefinitionCode(tinfo, withNamespace);
public static string GetTableDefinitionCode( this ITableMetaInfoBuilder tmiBldr, Type type, TDCodeGenerator codeGenOps = null, bool withNamespace = true) => codeGenOps.E().GetTableDefinitionCode(tmiBldr, type, withNamespace);
public static string GetTableMetaInfoCode( this ITableMetaInfo tmi) => TDCodeGenerator.GetTableMetaInfoCodeStatic(tmi);
public static string GetTableDefinitionsCodeForEntityTypes( this ITableMetaInfoBuilder tmiBldr, IEnumerable <Type> types, TDCodeGenerator codeGenOps = null, bool withNamespace = true) => codeGenOps.E().GetTableDefinitionsCodeForEntityTypes(tmiBldr, types, codeGenOps, withNamespace);