模板准备完毕,剩下如何适配生成以后自动生成视图模型和service
continuous-integration/drone/push Build is passing

This commit is contained in:
hang
2024-09-08 21:42:13 +08:00
parent fff6ef5fe2
commit 55e0624dc6
8 changed files with 46 additions and 37 deletions
+29 -24
View File
@@ -17,42 +17,46 @@ partial class Program
//发布的目录和项目的目录有区别的
var rootPath = AppContext.BaseDirectory.Replace(@"\bin\net8.0\", "").Replace(@"\bin\Release\net8.0\", "");
var templateFolderPath = Path.Combine(rootPath, "Template");
var outPutTemplateFolderPath = Path.Combine(rootPath, "TemplateOutPut");
var templateFolderPath = Path.Combine(rootPath, "LiquidTemplate");
var outPutTemplateFolderPath = Path.Combine(rootPath, "LiquidTemplateOutPut");
#region
if (!Directory.Exists(outPutTemplateFolderPath))
{
Directory.CreateDirectory(outPutTemplateFolderPath);
}
var servicePath = Path.Combine(outPutTemplateFolderPath, "Service");
var iServicePath = Path.Combine(outPutTemplateFolderPath, "IService");
var entityPath = Path.Combine(outPutTemplateFolderPath, "Entity");
var dtoPath = Path.Combine(outPutTemplateFolderPath, "DTO");
if (!Directory.Exists(servicePath))
{
Directory.CreateDirectory(servicePath);
}
if (!Directory.Exists(iServicePath))
{
Directory.CreateDirectory(iServicePath);
}
if (!Directory.Exists(entityPath))
{
Directory.CreateDirectory(entityPath);
}
if (!Directory.Exists(dtoPath))
{
Directory.CreateDirectory(dtoPath);
}
#region
//var servicePath = Path.Combine(outPutTemplateFolderPath, "Service");
//var iServicePath = Path.Combine(outPutTemplateFolderPath, "IService");
//var entityPath = Path.Combine(outPutTemplateFolderPath, "Entity");
//var dtoPath = Path.Combine(outPutTemplateFolderPath, "DTO");
//if (!Directory.Exists(servicePath))
//{
// Directory.CreateDirectory(servicePath);
//}
//if (!Directory.Exists(iServicePath))
//{
// Directory.CreateDirectory(iServicePath);
//}
//if (!Directory.Exists(entityPath))
//{
// Directory.CreateDirectory(entityPath);
//}
//if (!Directory.Exists(dtoPath))
//{
// Directory.CreateDirectory(dtoPath);
//}
#endregion
#endregion
// 要生成的表名数组
var tableNames = new List<string> { /*"Subject", "Order"*/ };
var tableNames = new List<string> { "Subject", "Order" };
try
{
@@ -234,7 +238,8 @@ partial class Program
public void CheckCodeFirst()
{
var contextOptions = new DbContextOptionsBuilder<IRaCISDBContext>().UseSqlServer(@"Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true").Options;
var contextOptions = new DbContextOptionsBuilder<IRaCISDBContext>()
.UseSqlServer(@"Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true").Options;
using var dbContext = new IRaCISDBContext(contextOptions);