From 51c5c478276e69739bc3b36c254708e3c0a76312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E5=86=A0=E9=9B=84?= Date: Sat, 27 Jul 2024 12:50:45 +0800 Subject: [PATCH] Fix: CreateExtensions.vue's content & format --- Bob.Abp.AppGen/Models/Enums/AbpMainFile.cs | 2 +- .../CreatingExtensions.vue | 3 +- .../CreatingExtensions_Calling.vue | 3 +- .../CreatingExtensions_Main.vue | 34 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Bob.Abp.AppGen/Models/Enums/AbpMainFile.cs b/Bob.Abp.AppGen/Models/Enums/AbpMainFile.cs index 8e392ef..72ff23a 100644 --- a/Bob.Abp.AppGen/Models/Enums/AbpMainFile.cs +++ b/Bob.Abp.AppGen/Models/Enums/AbpMainFile.cs @@ -112,7 +112,7 @@ public static class AbpMainFileExtension new[] { new AhProjectItem(AbpProjectType.Web, "Menus", "MenuItemInfo.cs", "Menu.MenuItemInfo", secured: true), new AhEditProjectItem(AbpProjectType.Web, "Menus", "{0}Menus.cs", vsCMElement.vsCMElementVariable, "{1}", "Menu.Consts" ) - .AddEditPoint(null, vsCMElement.vsCMElementClass, Positions.End, "TemplateType"), + .AddEditPoint(null, vsCMElement.vsCMElementClass, Positions.End, TemplateType.Main), new AhEditProjectItem(AbpProjectType.Web, "Menus", "{0}MenuContributor.cs", vsCMElement.vsCMElementFunction, "Configure{0}MenuAsync", "Menu.ContributorModify", secured: true) .AddEditPoint(null, vsCMElement.vsCMElementNamespace, Positions.Before, TemplateType.Using) .AddEditPoint("ConfigureMenuAsync", vsCMElement.vsCMElementFunction, Positions.End | Positions.ExtraMove, TemplateType.Calling) diff --git a/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions.vue b/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions.vue index ead508e..e524d52 100644 --- a/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions.vue +++ b/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions.vue @@ -1,7 +1,8 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp; +using Volo.Abp.EntityFrameworkCore.Modeling; -namespace {{Namespace}} +namespace {{RootNamespace}}.{{ModuleName}}.EntityFrameworkCore { public static class {{ModuleName}}DbContextModelCreatingExtensions { diff --git a/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions_Calling.vue b/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions_Calling.vue index 80be121..1a2c3ba 100644 --- a/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions_Calling.vue +++ b/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions_Calling.vue @@ -1,2 +1 @@ - - Configure{{EntityName}}(builder); + Configure{{EntityName}}(builder); diff --git a/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions_Main.vue b/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions_Main.vue index 1dc52b3..ee00d34 100644 --- a/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions_Main.vue +++ b/Bob.Abp.AppGen/Templates/EntityFrameworkCore/CreatingExtensions_Main.vue @@ -1,21 +1,21 @@  - private static void Configure{{EntityName}}(ModelBuilder builder) - { - builder.Entity<{{EntityName}}>(b => + private static void Configure{{EntityName}}(ModelBuilder builder) { - //Configure table & schema name - b.ToTable({{ModuleName}}DbProperties.DbTablePrefix + "{{ToPlural EntityName}}", {{ModuleName}}DbProperties.DbSchema); - b.ConfigureByConvention(); - {{#AllProperties}} - {{#IsString}} - b.Property(q => q.{{PropertyName}}){{#Required}}.IsRequired(){{/Required}}.HasMaxLength({{EntityName}}Consts.Max{{PropertyName}}Length); - {{/IsString}} - {{/AllProperties}} + builder.Entity<{{EntityName}}>(b => + { + //Configure table & schema name + b.ToTable({{ModuleName}}DbProperties.DbTablePrefix + "{{ToPlural EntityName}}", {{ModuleName}}DbProperties.DbSchema); + b.ConfigureByConvention(); + {{#AllProperties}} + {{#IsString}} + b.Property(q => q.{{PropertyName}}){{#Required}}.IsRequired(){{/Required}}.HasMaxLength({{EntityName}}Consts.Max{{PropertyName}}Length); + {{/IsString}} + {{/AllProperties}} - //Relations - //b.HasMany<{{EntityName}}>().WithOne().HasForeignKey(p => p.ParentId).OnDelete(DeleteBehavior.ClientSetNull); + //Relations + //b.HasMany<{{EntityName}}>().WithOne().HasForeignKey(p => p.ParentId).OnDelete(DeleteBehavior.ClientSetNull); - //Indexes - //b.HasIndex(q => q.Code); - }); - } + //Indexes + //b.HasIndex(q => q.Code); + }); + }