void Start() { string namesapce = _generatorOptions.NameSapce; if (string.IsNullOrEmpty(namesapce)) { Console.WriteLine("请在配置文件中配置命名空间,如:<add key =\"namesapce\" value=\"My.ORMTest\"/>"); return; } while (true) { Console.WriteLine(); Console.WriteLine(); Console.WriteLine("************请选择操作:*****************"); Console.WriteLine("1:基本实体"); Console.WriteLine("2:ORM实体"); Console.WriteLine("q:退出"); Console.WriteLine("*****************************************"); Console.WriteLine(); string type = Console.ReadLine(); IEntityBuilder builder = _builderFactory.GetEntityBuilder(type); if (builder != null) { } else if (type == "q") { Environment.Exit(0); } else { Console.WriteLine("怎么选择了一个空的操作呢,请继续......"); continue; } Console.WriteLine("开始生成......"); Console.WriteLine(); WithException(() => { foreach (var item in _generatorOptions.Databases) { builder.Builder(item.DBtype, item.ConnectionStrings); } }); Console.WriteLine(); Console.WriteLine("生成成功......"); Console.WriteLine(); Console.WriteLine(); } }
void Start() { string namesapce = _generatorOptions.NameSapce; if (string.IsNullOrEmpty(namesapce)) { Console.WriteLine("请在配置文件中配置命名空间,如:<add key =\"namesapce\" value=\"My.ORMTest\"/>"); return; } string type = "2"; IEntityBuilder builder = _builderFactory.GetEntityBuilder(type); Console.WriteLine(); ConsoleEx.WriteLine(ConsoleColor.DarkMagenta, "开始生成......"); Console.WriteLine(); WithException(() => { int index = 0; foreach (var item in _generatorOptions.Databases) { index++; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine($"数据库{index}:{item.ConnectionStrings}"); builder.Builder(item.DBtype, item.ConnectionStrings); Console.WriteLine(); Console.ResetColor(); } }); Console.WriteLine(); ConsoleEx.WriteLine(ConsoleColor.DarkMagenta, "生成成功......"); Console.WriteLine(); Console.WriteLine(); Environment.Exit(0); }