2023-01-24 20:20:32 +08:00
|
|
|
|
using Yi.Framework.Core.Helper;
|
|
|
|
|
|
using Yi.Framework.Template;
|
2023-01-21 18:09:21 +08:00
|
|
|
|
using Yi.Framework.Template.Provider.Server;
|
|
|
|
|
|
using Yi.Framework.Template.Provider.Site;
|
|
|
|
|
|
|
|
|
|
|
|
TemplateFactory templateFactory = new();
|
|
|
|
|
|
|
|
|
|
|
|
//选择需要生成的模板提供者
|
|
|
|
|
|
|
2023-01-21 22:40:10 +08:00
|
|
|
|
string modelName = "School";
|
2023-01-24 20:46:00 +08:00
|
|
|
|
string nameSpaces = "Yi.BBS";
|
2023-01-21 22:40:10 +08:00
|
|
|
|
List<string> entityNames = new() { "Student" };
|
2023-01-21 18:09:21 +08:00
|
|
|
|
|
|
|
|
|
|
foreach (var entityName in entityNames)
|
|
|
|
|
|
{
|
|
|
|
|
|
templateFactory.CreateTemplateProviders((option) =>
|
|
|
|
|
|
{
|
2023-01-24 20:46:00 +08:00
|
|
|
|
option.Add(new ServiceTemplateProvider(modelName, entityName, nameSpaces));
|
|
|
|
|
|
option.Add(new IServiceTemplateProvider(modelName, entityName, nameSpaces));
|
2023-01-21 18:09:21 +08:00
|
|
|
|
|
2023-01-24 20:46:00 +08:00
|
|
|
|
option.Add(new CreateInputVoTemplateProvider(modelName, entityName, nameSpaces));
|
|
|
|
|
|
option.Add(new UpdateInputVoTemplateProvider(modelName, entityName, nameSpaces));
|
|
|
|
|
|
option.Add(new GetListInputVoTemplateProvider(modelName, entityName, nameSpaces));
|
|
|
|
|
|
option.Add(new GetListOutputDtoTemplateProvider(modelName, entityName, nameSpaces));
|
|
|
|
|
|
option.Add(new GetOutputDtoTemplateProvider(modelName, entityName, nameSpaces));
|
2023-01-21 18:09:21 +08:00
|
|
|
|
|
2023-01-24 20:46:00 +08:00
|
|
|
|
option.Add(new ConstTemplateProvider(modelName, entityName, nameSpaces));
|
|
|
|
|
|
option.Add(new ProfileTemplateProvider(modelName, entityName, nameSpaces));
|
2023-01-21 22:40:10 +08:00
|
|
|
|
//option.Add(new ApiTemplateProvider(modelName, entityName));
|
2023-01-21 18:09:21 +08:00
|
|
|
|
});
|
|
|
|
|
|
//开始构建模板
|
2023-01-24 20:28:33 +08:00
|
|
|
|
//templateFactory.BuildTemplate();
|
2023-01-21 18:09:21 +08:00
|
|
|
|
Console.WriteLine($"Yi.Framework.Template:{entityName}构建完成!");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Yi.Framework.Template:模板全部生成完成!");
|
2023-01-24 20:20:32 +08:00
|
|
|
|
Console.ReadKey();
|
|
|
|
|
|
|
|
|
|
|
|
//根据模板文件生成项目文件
|
2023-01-24 20:28:33 +08:00
|
|
|
|
//var template = "D:\\C#\\Yi\\Yi.Framework.Net6\\src\\project\\BBS";
|
|
|
|
|
|
//FileHelper.AllInfoReplace(template, "Template", "BBS");
|