Browse Source

Make UniqueName of Category unique within the tenant.

pull/119/head 2.2.0
gdlcf88 5 years ago
parent
commit
b8ca65281c
  1. 2
      common.props
  2. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Categories/Dtos/CreateUpdateCategoryDto.cs
  3. 18
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/CategoryAppService.cs
  4. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs
  5. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json
  6. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json
  7. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json
  8. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json
  9. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json
  10. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json
  11. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json
  12. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hans.json
  13. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hant.json
  14. 18
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/Category.cs
  15. 40
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/CategoryManager.cs
  16. 12
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/DuplicateCategoryUniqueNameException.cs
  17. 26
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/ICategoryManager.cs
  18. 16
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Categories/CategoryRepository.cs
  19. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/ProductsDbContextModelCreatingExtensions.cs
  20. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Categories/Category/Index.cshtml
  21. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Categories/Category/index.js
  22. 5111
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20210603080004_UpgradedPaymentServiceTo1_10_2.Designer.cs
  23. 45
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20210603080004_UpgradedPaymentServiceTo1_10_2.cs
  24. 5107
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20210603080044_RemovedUniqueIndexOfCategoryUniqueName.Designer.cs
  25. 42
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20210603080044_RemovedUniqueIndexOfCategoryUniqueName.cs
  26. 19
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/EShopSampleMigrationsDbContextModelSnapshot.cs

2
common.props

@ -1,7 +1,7 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Version>2.1.8</Version> <Version>2.2.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors> <Authors>EasyAbp Team</Authors>

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Categories/Dtos/CreateUpdateCategoryDto.cs

@ -23,5 +23,8 @@ namespace EasyAbp.EShop.Products.Categories.Dtos
[DisplayName("CategoryMediaResources")] [DisplayName("CategoryMediaResources")]
public string MediaResources { get; set; } public string MediaResources { get; set; }
[DisplayName("CategoryIsHidden")]
public bool IsHidden { get; set; }
} }
} }

18
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/CategoryAppService.cs

@ -20,10 +20,14 @@ namespace EasyAbp.EShop.Products.Categories
protected override string GetPolicyName { get; set; } = null; protected override string GetPolicyName { get; set; } = null;
protected override string GetListPolicyName { get; set; } = null; protected override string GetListPolicyName { get; set; } = null;
private readonly ICategoryManager _categoryManager;
private readonly ICategoryRepository _repository; private readonly ICategoryRepository _repository;
public CategoryAppService(ICategoryRepository repository) : base(repository) public CategoryAppService(
ICategoryManager categoryManager,
ICategoryRepository repository) : base(repository)
{ {
_categoryManager = categoryManager;
_repository = repository; _repository = repository;
} }
@ -34,6 +38,18 @@ namespace EasyAbp.EShop.Products.Categories
return input.ShowHidden ? query : query.Where(x => !x.IsHidden); return input.ShowHidden ? query : query.Where(x => !x.IsHidden);
} }
protected override async Task<Category> MapToEntityAsync(CreateUpdateCategoryDto createInput)
{
return await _categoryManager.CreateAsync(createInput.ParentId, createInput.UniqueName,
createInput.DisplayName, createInput.Description, createInput.MediaResources, createInput.IsHidden);
}
protected override async Task MapToEntityAsync(CreateUpdateCategoryDto updateInput, Category entity)
{
await _categoryManager.UpdateAsync(entity, updateInput.ParentId, updateInput.UniqueName,
updateInput.DisplayName, updateInput.Description, updateInput.MediaResources, updateInput.IsHidden);
}
public override async Task<PagedResultDto<CategoryDto>> GetListAsync(GetCategoryListDto input) public override async Task<PagedResultDto<CategoryDto>> GetListAsync(GetCategoryListDto input)
{ {
if (input.ShowHidden && !await AuthorizationService.IsGrantedAsync(ProductsPermissions.Categories.ShowHidden)) if (input.ShowHidden && !await AuthorizationService.IsGrantedAsync(ProductsPermissions.Categories.ShowHidden))

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs

@ -62,7 +62,6 @@ namespace EasyAbp.EShop.Products
CreateMap<UpdateProductSkuDto, ProductSku>(MemberList.Source); CreateMap<UpdateProductSkuDto, ProductSku>(MemberList.Source);
CreateMap<Category, CategoryDto>(); CreateMap<Category, CategoryDto>();
CreateMap<Category, CategorySummaryDto>(); CreateMap<Category, CategorySummaryDto>();
CreateMap<CreateUpdateCategoryDto, Category>(MemberList.Source);
CreateMap<ProductCategory, ProductCategoryDto>(); CreateMap<ProductCategory, ProductCategoryDto>();
CreateMap<ProductHistory, ProductHistoryDto>(); CreateMap<ProductHistory, ProductHistoryDto>();
CreateMap<ProductDetailHistory, ProductDetailHistoryDto>(); CreateMap<ProductDetailHistory, ProductDetailHistoryDto>();

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/cs.json

@ -66,6 +66,7 @@
"CategoryDisplayName": "Display name", "CategoryDisplayName": "Display name",
"CategoryDescription": "Description", "CategoryDescription": "Description",
"CategoryMediaResources": "Media resources", "CategoryMediaResources": "Media resources",
"CategoryIsHidden": "Hidden",
"CreateCategory": "New", "CreateCategory": "New",
"EditCategory": "Edit", "EditCategory": "Edit",
"CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?", "CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?",

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json

@ -67,6 +67,7 @@
"CategoryDisplayName": "Display name", "CategoryDisplayName": "Display name",
"CategoryDescription": "Description", "CategoryDescription": "Description",
"CategoryMediaResources": "Media resources", "CategoryMediaResources": "Media resources",
"CategoryIsHidden": "Hidden",
"CreateCategory": "New", "CreateCategory": "New",
"EditCategory": "Edit", "EditCategory": "Edit",
"CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?", "CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?",

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pl.json

@ -66,6 +66,7 @@
"CategoryDisplayName": "Display name", "CategoryDisplayName": "Display name",
"CategoryDescription": "Description", "CategoryDescription": "Description",
"CategoryMediaResources": "Media resources", "CategoryMediaResources": "Media resources",
"CategoryIsHidden": "Hidden",
"CreateCategory": "New", "CreateCategory": "New",
"EditCategory": "Edit", "EditCategory": "Edit",
"CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?", "CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?",

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/pt-BR.json

@ -66,6 +66,7 @@
"CategoryDisplayName": "Display name", "CategoryDisplayName": "Display name",
"CategoryDescription": "Description", "CategoryDescription": "Description",
"CategoryMediaResources": "Media resources", "CategoryMediaResources": "Media resources",
"CategoryIsHidden": "Hidden",
"CreateCategory": "New", "CreateCategory": "New",
"EditCategory": "Edit", "EditCategory": "Edit",
"CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?", "CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?",

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/sl.json

@ -67,6 +67,7 @@
"CategoryDisplayName": "Display name", "CategoryDisplayName": "Display name",
"CategoryDescription": "Description", "CategoryDescription": "Description",
"CategoryMediaResources": "Media resources", "CategoryMediaResources": "Media resources",
"CategoryIsHidden": "Hidden",
"CreateCategory": "New", "CreateCategory": "New",
"EditCategory": "Edit", "EditCategory": "Edit",
"CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?", "CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?",

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/tr.json

@ -67,6 +67,7 @@
"CategoryDisplayName": "Display name", "CategoryDisplayName": "Display name",
"CategoryDescription": "Description", "CategoryDescription": "Description",
"CategoryMediaResources": "Media resources", "CategoryMediaResources": "Media resources",
"CategoryIsHidden": "Hidden",
"CreateCategory": "New", "CreateCategory": "New",
"EditCategory": "Edit", "EditCategory": "Edit",
"CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?", "CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?",

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/vi.json

@ -66,6 +66,7 @@
"CategoryDisplayName": "Display name", "CategoryDisplayName": "Display name",
"CategoryDescription": "Description", "CategoryDescription": "Description",
"CategoryMediaResources": "Media resources", "CategoryMediaResources": "Media resources",
"CategoryIsHidden": "Hidden",
"CreateCategory": "New", "CreateCategory": "New",
"EditCategory": "Edit", "EditCategory": "Edit",
"CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?", "CategoryDeletionConfirmationMessage": "Are you sure to delete the category {0}?",

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hans.json

@ -64,6 +64,7 @@
"CategoryDisplayName": "类目名称", "CategoryDisplayName": "类目名称",
"CategoryDescription": "描述", "CategoryDescription": "描述",
"CategoryMediaResources": "多媒体资源", "CategoryMediaResources": "多媒体资源",
"CategoryIsHidden": "隐藏",
"CreateCategory": "新建", "CreateCategory": "新建",
"EditCategory": "编辑", "EditCategory": "编辑",
"CategoryDeletionConfirmationMessage": "确认删除类目 {0}?", "CategoryDeletionConfirmationMessage": "确认删除类目 {0}?",

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/zh-Hant.json

@ -64,6 +64,7 @@
"CategoryDisplayName": "類目名稱", "CategoryDisplayName": "類目名稱",
"CategoryDescription": "描述", "CategoryDescription": "描述",
"CategoryMediaResources": "多媒體資源", "CategoryMediaResources": "多媒體資源",
"CategoryIsHidden": "隱藏",
"CreateCategory": "新建", "CreateCategory": "新建",
"EditCategory": "編輯", "EditCategory": "編輯",
"CategoryDeletionConfirmationMessage": "確認刪除類目 {0}?", "CategoryDeletionConfirmationMessage": "確認刪除類目 {0}?",

18
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/Category.cs

@ -44,17 +44,31 @@ namespace EasyAbp.EShop.Products.Categories
{ {
} }
public Category( internal Category(
Guid id, Guid id,
Guid? tenantId, Guid? tenantId,
Guid? parentId,
string uniqueName, string uniqueName,
string displayName, string displayName,
string description, string description,
string mediaResources, string mediaResources,
bool isHidden bool isHidden
) :base(id) ) : base(id)
{ {
TenantId = tenantId; TenantId = tenantId;
Update(parentId, uniqueName, displayName, description, mediaResources, isHidden);
}
internal void Update(
Guid? parentId,
string uniqueName,
string displayName,
string description,
string mediaResources,
bool isHidden)
{
ParentId = parentId;
UniqueName = uniqueName; UniqueName = uniqueName;
DisplayName = displayName; DisplayName = displayName;
Description = description; Description = description;

40
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/CategoryManager.cs

@ -0,0 +1,40 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
namespace EasyAbp.EShop.Products.Categories
{
public class CategoryManager : DomainService, ICategoryManager
{
private readonly ICategoryRepository _repository;
public CategoryManager(ICategoryRepository repository)
{
_repository = repository;
}
public virtual async Task<Category> CreateAsync(Guid? parentId, string uniqueName, string displayName,
string description, string mediaResources, bool isHidden)
{
if (await _repository.AnyAsync(x => x.UniqueName == uniqueName))
{
throw new DuplicateCategoryUniqueNameException();
}
return new Category(GuidGenerator.Create(), CurrentTenant.Id, parentId, uniqueName, displayName,
description, mediaResources, isHidden);
}
public virtual async Task UpdateAsync(Category entity, Guid? parentId, string uniqueName, string displayName, string description,
string mediaResources, bool isHidden)
{
if (await _repository.AnyAsync(x => x.UniqueName == uniqueName && x.Id != entity.Id))
{
throw new DuplicateCategoryUniqueNameException();
}
entity.Update(parentId, uniqueName, displayName, description, mediaResources, isHidden);
}
}
}

12
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/DuplicateCategoryUniqueNameException.cs

@ -0,0 +1,12 @@
using Volo.Abp;
namespace EasyAbp.EShop.Products.Categories
{
public class DuplicateCategoryUniqueNameException : BusinessException
{
public DuplicateCategoryUniqueNameException() : base("DuplicateCategoryUniqueName")
{
}
}
}

26
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/ICategoryManager.cs

@ -0,0 +1,26 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
namespace EasyAbp.EShop.Products.Categories
{
public interface ICategoryManager : IDomainService
{
Task<Category> CreateAsync(
Guid? parentId,
string uniqueName,
string displayName,
string description,
string mediaResources,
bool isHidden);
Task UpdateAsync(
Category entity,
Guid? parentId,
string uniqueName,
string displayName,
string description,
string mediaResources,
bool isHidden);
}
}

16
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Categories/CategoryRepository.cs

@ -1,4 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using EasyAbp.Abp.Trees; using EasyAbp.Abp.Trees;
using EasyAbp.EShop.Products.EntityFrameworkCore; using EasyAbp.EShop.Products.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
@ -11,5 +15,17 @@ namespace EasyAbp.EShop.Products.Categories
public CategoryRepository(IDbContextProvider<IProductsDbContext> dbContextProvider) : base(dbContextProvider) public CategoryRepository(IDbContextProvider<IProductsDbContext> dbContextProvider) : base(dbContextProvider)
{ {
} }
public override Task InsertManyAsync(IEnumerable<Category> entities, bool autoSave = false,
CancellationToken cancellationToken = new CancellationToken())
{
throw new NotSupportedException();
}
public override Task UpdateManyAsync(IEnumerable<Category> entities, bool autoSave = false,
CancellationToken cancellationToken = new CancellationToken())
{
throw new NotSupportedException();
}
} }
} }

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/ProductsDbContextModelCreatingExtensions.cs

@ -91,9 +91,6 @@ namespace EasyAbp.EShop.Products.EntityFrameworkCore
b.ToTable(options.TablePrefix + "Categories", options.Schema); b.ToTable(options.TablePrefix + "Categories", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
/* Configure more properties here */ /* Configure more properties here */
// Todo: soft delete support?
b.HasIndex(x => x.UniqueName).IsUnique();
}); });
builder.Entity<ProductCategory>(b => builder.Entity<ProductCategory>(b =>

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Categories/Category/Index.cshtml

@ -50,7 +50,7 @@
<th>@L["CategoryUniqueName"]</th> <th>@L["CategoryUniqueName"]</th>
<th>@L["CategoryDisplayName"]</th> <th>@L["CategoryDisplayName"]</th>
<th>@L["CategoryDescription"]</th> <th>@L["CategoryDescription"]</th>
<th>@L["CategoryMediaResources"]</th> <th>@L["CategoryIsHidden"]</th>
</tr> </tr>
</thead> </thead>
</abp-table> </abp-table>

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Categories/Category/index.js

@ -59,7 +59,7 @@ $(function () {
{ data: "uniqueName" }, { data: "uniqueName" },
{ data: "displayName" }, { data: "displayName" },
{ data: "description" }, { data: "description" },
{ data: "mediaResources" }, { data: "isHidden" },
] ]
})); }));

5111
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20210603080004_UpgradedPaymentServiceTo1_10_2.Designer.cs

File diff suppressed because it is too large

45
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20210603080004_UpgradedPaymentServiceTo1_10_2.cs

@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace EShopSample.Migrations
{
public partial class UpgradedPaymentServiceTo1_10_2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "PendingTopUpPaymentId",
table: "EasyAbpPaymentServicePrepaymentAccounts",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "PendingWithdrawalAmount",
table: "EasyAbpPaymentServicePrepaymentAccounts",
type: "decimal(18,2)",
nullable: false,
defaultValue: 0m);
migrationBuilder.AddColumn<Guid>(
name: "PendingWithdrawalRecordId",
table: "EasyAbpPaymentServicePrepaymentAccounts",
type: "uniqueidentifier",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PendingTopUpPaymentId",
table: "EasyAbpPaymentServicePrepaymentAccounts");
migrationBuilder.DropColumn(
name: "PendingWithdrawalAmount",
table: "EasyAbpPaymentServicePrepaymentAccounts");
migrationBuilder.DropColumn(
name: "PendingWithdrawalRecordId",
table: "EasyAbpPaymentServicePrepaymentAccounts");
}
}
}

5107
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20210603080044_RemovedUniqueIndexOfCategoryUniqueName.Designer.cs

File diff suppressed because it is too large

42
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20210603080044_RemovedUniqueIndexOfCategoryUniqueName.cs

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace EShopSample.Migrations
{
public partial class RemovedUniqueIndexOfCategoryUniqueName : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_EasyAbpEShopProductsCategories_UniqueName",
table: "EasyAbpEShopProductsCategories");
migrationBuilder.AlterColumn<string>(
name: "UniqueName",
table: "EasyAbpEShopProductsCategories",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(450)",
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "UniqueName",
table: "EasyAbpEShopProductsCategories",
type: "nvarchar(450)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_EasyAbpEShopProductsCategories_UniqueName",
table: "EasyAbpEShopProductsCategories",
column: "UniqueName",
unique: true,
filter: "[UniqueName] IS NOT NULL");
}
}
}

19
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/EShopSampleMigrationsDbContextModelSnapshot.cs

@ -16,10 +16,10 @@ namespace EShopSample.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.UseIdentityColumns()
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.2"); .HasAnnotation("ProductVersion", "5.0.6")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("EasyAbp.EShop.Orders.Orders.Order", b => modelBuilder.Entity("EasyAbp.EShop.Orders.Orders.Order", b =>
{ {
@ -1057,16 +1057,12 @@ namespace EShopSample.Migrations
.HasColumnName("TenantId"); .HasColumnName("TenantId");
b.Property<string>("UniqueName") b.Property<string>("UniqueName")
.HasColumnType("nvarchar(450)"); .HasColumnType("nvarchar(max)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ParentId"); b.HasIndex("ParentId");
b.HasIndex("UniqueName")
.IsUnique()
.HasFilter("[UniqueName] IS NOT NULL");
b.ToTable("EasyAbpEShopProductsCategories"); b.ToTable("EasyAbpEShopProductsCategories");
}); });
@ -2066,6 +2062,15 @@ namespace EShopSample.Migrations
b.Property<decimal>("LockedBalance") b.Property<decimal>("LockedBalance")
.HasColumnType("decimal(20,8)"); .HasColumnType("decimal(20,8)");
b.Property<Guid?>("PendingTopUpPaymentId")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("PendingWithdrawalAmount")
.HasColumnType("decimal(18,2)");
b.Property<Guid?>("PendingWithdrawalRecordId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId") b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier") .HasColumnType("uniqueidentifier")
.HasColumnName("TenantId"); .HasColumnName("TenantId");

Loading…
Cancel
Save