private static void GenService(GeneratorModel generator, DatabaseServiceModel databaseService) { var serviceFile = File.CreateText($"{databaseService.ServiceName}Service.cs"); var serviceGeneration = EFCoreServiceGeneration.CreatEFCoreDefaultService(databaseService, generator); serviceGeneration.WriteTo(serviceFile); serviceFile.Close(); }
private void GenUniformService(GeneratorModel generator, DatabaseServiceModel databaseService) { string folderpath = $"CreatedFile{FolderSymbol}Service{FolderSymbol}"; if (!string.IsNullOrWhiteSpace(databaseService.FolderGroupName)) { folderpath += $"{databaseService.FolderGroupName}{FolderSymbol}"; } Directory.CreateDirectory(folderpath); var serviceFile = File.CreateText($"{folderpath}{generator.UniformServiceName}Service.{databaseService.ServiceName}.cs"); var serviceGeneration = EFCoreServiceInOneGeneration.CreatEFCoreDefaultService(databaseService, generator); serviceGeneration.WriteTo(serviceFile); serviceFile.Close(); }
static void Main(string[] args) { var applicationDbName = "ApplicationDbContext"; var namespace_string = "WebApi"; var usingList = new List <string>(); usingList.Add(new string("WebApiModel")); usingList.Add(new string("WebApi.Database")); DatabaseServiceModel databaseService = new DatabaseServiceModel("DbGenerationModel", "MyDbs", usingList); var db_List = new List <DatabaseServiceModel>(); db_List.Add(databaseService); GeneratorModel generator = new GeneratorModel(applicationDbName, namespace_string, db_List); Generation generation = new Generation(); generation.Execute(generator, false); //GenDB(generator); //foreach (var item in db_List) //{ // GenService(generator, item); //} }