public MessageModel <string> GetFrameFiles() { var data = new MessageModel <string>() { success = true, msg = "" }; if (Env.IsDevelopment()) { BaseDBConfig.MutiConnectionString.Item1.ToList().ForEach(m => { _sqlSugarClient.ChangeDatabase(m.ConnId.ToLower()); data.response += $"库{m.ConnId}-Model层生成:{FrameSeed.CreateModels(_sqlSugarClient, m.ConnId)} || "; data.response += $"库{m.ConnId}-IRepositorys层生成:{FrameSeed.CreateIRepositorys(_sqlSugarClient, m.ConnId)} || "; data.response += $"库{m.ConnId}-IServices层生成:{FrameSeed.CreateIServices(_sqlSugarClient, m.ConnId)} || "; data.response += $"库{m.ConnId}-Repository层生成:{FrameSeed.CreateRepository(_sqlSugarClient, m.ConnId)} || "; data.response += $"库{m.ConnId}-Services层生成:{FrameSeed.CreateServices(_sqlSugarClient, m.ConnId)} || "; }); // 切回主库 _sqlSugarClient.ChangeDatabase(MainDb.CurrentDbConnId.ToLower()); } else { data.success = false; data.msg = "当前不处于开发模式,代码生成不可用!"; } return(data); }
public MessageModel <string> GetFrameFilesByTableNames([FromBody] string[] tableNames, [FromQuery] string ConnID = null) { ConnID = ConnID == null?MainDb.CurrentDbConnId.ToLower() : ConnID; var isMuti = Appsettings.app(new string[] { "MutiDBEnabled" }).ObjToBool(); var data = new MessageModel <string>() { success = true, msg = "" }; if (Env.IsDevelopment()) { data.response += $"库{ConnID}-IRepositorys层生成:{FrameSeed.CreateIRepositorys(_sqlSugarClient, ConnID, isMuti, tableNames)} || "; data.response += $"库{ConnID}-IServices层生成:{FrameSeed.CreateIServices(_sqlSugarClient, ConnID, isMuti, tableNames)} || "; data.response += $"库{ConnID}-Repository层生成:{FrameSeed.CreateRepository(_sqlSugarClient, ConnID, isMuti, tableNames)} || "; data.response += $"库{ConnID}-Services层生成:{FrameSeed.CreateServices(_sqlSugarClient, ConnID, isMuti, tableNames)} || "; } else { data.success = false; data.msg = "当前不处于开发模式,代码生成不可用!"; } return(data); }
public MessageModel <string> GetFrameFiles() { var data = new MessageModel <string>() { success = true, msg = "" }; data.response += @"file path is:C:\my-file\}"; var isMuti = Appsettings.app(new string[] { "MutiDBEnabled" }).ObjToBool(); if (Env.IsDevelopment()) { data.response += $"Controller层生成:{FrameSeed.CreateControllers(_sqlSugarClient)} || "; BaseDBConfig.MutiConnectionString.Item1.ToList().ForEach(m => { _sqlSugarClient.ChangeDatabase(m.ConnId.ToLower()); data.response += $"库{m.ConnId}-Model层生成:{FrameSeed.CreateModels(_sqlSugarClient, m.ConnId, isMuti)} || "; data.response += $"库{m.ConnId}-IRepositorys层生成:{FrameSeed.CreateIRepositorys(_sqlSugarClient, m.ConnId, isMuti)} || "; data.response += $"库{m.ConnId}-IServices层生成:{FrameSeed.CreateIServices(_sqlSugarClient, m.ConnId, isMuti)} || "; data.response += $"库{m.ConnId}-Repository层生成:{FrameSeed.CreateRepository(_sqlSugarClient, m.ConnId, isMuti)} || "; data.response += $"库{m.ConnId}-Services层生成:{FrameSeed.CreateServices(_sqlSugarClient, m.ConnId, isMuti)} || "; }); // 切回主库 _sqlSugarClient.ChangeDatabase(MainDb.CurrentDbConnId.ToLower()); } else { data.success = false; data.msg = "当前不处于开发模式,代码生成不可用!"; } return(data); }
public bool GetFrameFiles() { return(FrameSeed.CreateModels(myContext) && FrameSeed.CreateIRepositorys(myContext) && FrameSeed.CreateIServices(myContext) && FrameSeed.CreateRepository(myContext) && FrameSeed.CreateServices(myContext) ); }
public static void Main(string[] args) { //新建表首次运行需要创建所有框架代码。添加字段只需要创建实体即可。如果只改了单个表字段,尽量添加相对应的表名进行生成 MyContext myContext = new MyContext(); //生成单个实体CreateModels(myContext,"表名") var modelResult = FrameSeed.CreateModels(myContext, new string[] { "cctv" }); //生成单个iRepository的CreateIRepositorys(myContext,"表名") var iRepositoryResult = FrameSeed.CreateIRepositorys(myContext, new string[] { "cctv" }); //生成单个iServices的iServicesResult(myContext,"表名") var iServicesResult = FrameSeed.CreateIServices(myContext, new string[] { "cctv" }); //生成单个repository的iServicesResult(myContext,"表名") var repositoryResult = FrameSeed.CreateRepository(myContext, new string[] { "cctv" }); //生成单个services的CreateServices(myContext,"表名") var servicesResult = FrameSeed.CreateServices(myContext, new string[] { "cctv" }); Console.WriteLine($"实体创建结果:{modelResult}\n iRepository创建结果:{iRepositoryResult}\n" + $"iServicesResult创建结果:{iServicesResult}\n repositoryResult创建结果:{repositoryResult}\n" + $"servicesResult创建结果:{servicesResult}\n "); }
public bool GetRepositoryFiles() { return(FrameSeed.CreateRepository(myContext)); }