diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs index f705593e87..8127e88f23 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs @@ -1,5 +1,4 @@ using System.Linq; -using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; @@ -99,7 +98,7 @@ namespace Volo.Abp.Application.Services CheckUpdatePolicy(); var entity = GetEntityById(id); - + MapToEntity(input, entity); CurrentUnitOfWork.SaveChanges(); diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs index 947c622081..eb4c7a200f 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs @@ -4,6 +4,7 @@ using System.Linq.Dynamic.Core; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; +using Volo.Abp.ObjectMapping; namespace Volo.Abp.Application.Services { @@ -11,7 +12,8 @@ namespace Volo.Abp.Application.Services /// This is a common base class for CrudAppService and AsyncCrudAppService classes. /// Inherit either from CrudAppService or AsyncCrudAppService, not from this class. /// - public abstract class CrudAppServiceBase : ApplicationService + public abstract class CrudAppServiceBase : + ApplicationService where TEntity : class, IEntity where TEntityDto : IEntityDto { diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs index 9e0a5cbacf..cb61fc6a82 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; +using System.Threading.Tasks; using Volo.Abp.Application.Services; namespace Volo.Abp.Identity diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleDto.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleDto.cs index c25ceace56..d55b68fcb1 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleDto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleDto.cs @@ -1,9 +1,10 @@ using System; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; namespace Volo.Abp.Identity { - public class IdentityRoleDto : EntityDto + public class IdentityRoleDto : EntityDto, IHasConcurrencyStamp { public string Name { get; set; } @@ -12,5 +13,7 @@ namespace Volo.Abp.Identity public bool IsStatic { get; set; } public bool IsPublic { get; set; } + + public string ConcurrencyStamp { get; set; } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleUpdateDto.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleUpdateDto.cs index c569957f23..c8a44f92c2 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleUpdateDto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleUpdateDto.cs @@ -1,7 +1,9 @@ -namespace Volo.Abp.Identity +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.Identity { - public class IdentityRoleUpdateDto : IdentityRoleCreateOrUpdateDtoBase + public class IdentityRoleUpdateDto : IdentityRoleCreateOrUpdateDtoBase, IHasConcurrencyStamp { - + public string ConcurrencyStamp { get; set; } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs index bc28a79f8e..02d1b10166 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs @@ -1,10 +1,11 @@ using System; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; using Volo.Abp.MultiTenancy; namespace Volo.Abp.Identity { - public class IdentityUserDto : FullAuditedEntityDto, IMultiTenant + public class IdentityUserDto : FullAuditedEntityDto, IMultiTenant, IHasConcurrencyStamp { public Guid? TenantId { get; set; } @@ -27,5 +28,7 @@ namespace Volo.Abp.Identity public bool LockoutEnabled { get; set; } public DateTimeOffset? LockoutEnd { get; set; } + + public string ConcurrencyStamp { get; set; } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs index 3117ff8003..a599207f23 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs @@ -1,6 +1,9 @@ -namespace Volo.Abp.Identity +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.Identity { - public class IdentityUserUpdateDto : IdentityUserCreateOrUpdateDtoBase + public class IdentityUserUpdateDto : IdentityUserCreateOrUpdateDtoBase, IHasConcurrencyStamp { + public string ConcurrencyStamp { get; set; } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs index f3ad2f880a..ed78156052 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs @@ -84,6 +84,7 @@ namespace Volo.Abp.Identity public async Task UpdateAsync(Guid id, IdentityRoleUpdateDto input) { var role = await _roleManager.GetByIdAsync(id); + role.ConcurrencyStamp = input.ConcurrencyStamp; (await _roleManager.SetRoleNameAsync(role, input.Name)).CheckErrors(); diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs index 054ce247ac..8c9a8ef015 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs @@ -72,6 +72,7 @@ namespace Volo.Abp.Identity public async Task UpdateAsync(Guid id, IdentityUserUpdateDto input) { var user = await _userManager.GetByIdAsync(id); + user.ConcurrencyStamp = input.ConcurrencyStamp; (await _userManager.SetUserNameAsync(user, input.UserName)).CheckErrors(); await UpdateUserByInput(user, input); diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeConsts.cs index 1b691f404c..32e3197e12 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeConsts.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeConsts.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Volo.Abp.Identity +namespace Volo.Abp.Identity { public class IdentityClaimTypeConsts { public const int MaxNameLength = 256; - public const int MaxRegexLength = 512; - public const int MaxRegexDescriptionLength = 128; - public const int MaxDescriptionLength = 256; + public const int MaxConcurrencyStampLength = 256; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs index 11bde27f34..cac33aa53d 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs @@ -4,5 +4,6 @@ { public const int MaxNameLength = 256; public const int MaxNormalizedNameLength = MaxNameLength; + public const int MaxConcurrencyStampLength = 256; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimType.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimType.cs index 5755279585..d8722669fb 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimType.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimType.cs @@ -1,12 +1,10 @@ using System; -using System.Collections.Generic; -using System.Text; using JetBrains.Annotations; using Volo.Abp.Domain.Entities; namespace Volo.Abp.Identity { - public class IdentityClaimType : Entity + public class IdentityClaimType : AggregateRoot { public virtual string Name { get; protected set; } @@ -24,12 +22,14 @@ namespace Volo.Abp.Identity protected IdentityClaimType() { + } public IdentityClaimType(Guid id, [NotNull] string name, bool required, bool isStatic, [CanBeNull]string regex, [CanBeNull]string regexDescription, [CanBeNull] string description, IdentityClaimValueType valueType = IdentityClaimValueType.String) { Check.NotNull(name, nameof(name)); + Id = id; Name = name; Required = required; IsStatic = isStatic; @@ -38,7 +38,5 @@ namespace Volo.Abp.Identity Description = description; ValueType = valueType; } - - } } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs index a0ffadea8c..27727da177 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore b.Property(u => u.NormalizedEmail).HasMaxLength(IdentityUserConsts.MaxNormalizedEmailLength).HasColumnName(nameof(IdentityUser.NormalizedEmail)); b.Property(u => u.PasswordHash).HasMaxLength(IdentityUserConsts.MaxPasswordHashLength).HasColumnName(nameof(IdentityUser.PasswordHash)); b.Property(u => u.SecurityStamp).IsRequired().HasMaxLength(IdentityUserConsts.MaxSecurityStampLength).HasColumnName(nameof(IdentityUser.SecurityStamp)); - b.Property(u => u.ConcurrencyStamp).IsRequired().HasMaxLength(IdentityUserConsts.MaxConcurrencyStampLength).HasColumnName(nameof(IdentityUser.ConcurrencyStamp)); + b.Property(u => u.ConcurrencyStamp).IsRequired().IsConcurrencyToken().HasMaxLength(IdentityUserConsts.MaxConcurrencyStampLength).HasColumnName(nameof(IdentityUser.ConcurrencyStamp)); b.Property(u => u.TwoFactorEnabled).HasDefaultValue(false).HasColumnName(nameof(IdentityUser.TwoFactorEnabled)); b.Property(u => u.LockoutEnabled).HasDefaultValue(false).HasColumnName(nameof(IdentityUser.LockoutEnabled)); b.Property(u => u.AccessFailedCount).HasDefaultValue(0).HasColumnName(nameof(IdentityUser.AccessFailedCount)); @@ -99,6 +99,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore b.Property(r => r.Name).IsRequired().HasMaxLength(IdentityRoleConsts.MaxNameLength); b.Property(r => r.NormalizedName).IsRequired().HasMaxLength(IdentityRoleConsts.MaxNormalizedNameLength); + b.Property(u => u.ConcurrencyStamp).IsRequired().IsConcurrencyToken().HasMaxLength(IdentityRoleConsts.MaxConcurrencyStampLength).HasColumnName(nameof(IdentityRole.ConcurrencyStamp)); b.Property(r => r.IsDefault).HasColumnName(nameof(IdentityRole.IsDefault)); b.Property(r => r.IsStatic).HasColumnName(nameof(IdentityRole.IsStatic)); b.Property(r => r.IsPublic).HasColumnName(nameof(IdentityRole.IsPublic)); @@ -122,11 +123,13 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { b.ToTable(options.TablePrefix + "ClaimTypes", options.Schema); + b.ConfigureExtraProperties(); + b.Property(uc => uc.Name).HasMaxLength(IdentityClaimTypeConsts.MaxNameLength).IsRequired(); // make unique b.Property(uc => uc.Regex).HasMaxLength(IdentityClaimTypeConsts.MaxRegexLength); b.Property(uc => uc.RegexDescription).HasMaxLength(IdentityClaimTypeConsts.MaxRegexDescriptionLength); b.Property(uc => uc.Description).HasMaxLength(IdentityClaimTypeConsts.MaxDescriptionLength); - + b.Property(uc => uc.ConcurrencyStamp).IsRequired().IsConcurrencyToken().HasMaxLength(IdentityClaimTypeConsts.MaxConcurrencyStampLength).HasColumnName(nameof(IdentityClaimType.ConcurrencyStamp)); }); } } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml index b09cfe2dcb..0a3cd3668d 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml @@ -12,9 +12,10 @@ + @if (Model.Role.IsStatic) { - + } else { diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs index 58703c211e..66259c6ba0 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs @@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.Domain.Entities; namespace Volo.Abp.Identity.Web.Pages.Identity.Roles { @@ -35,11 +36,14 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles return NoContent(); } - public class RoleInfoModel + public class RoleInfoModel : IHasConcurrencyStamp { [HiddenInput] public Guid Id { get; set; } + [HiddenInput] + public string ConcurrencyStamp { get; set; } + [Required] [StringLength(IdentityRoleConsts.MaxNameLength)] [Display(Name = "DisplayName:RoleName")] diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml index afa0df85ed..be9cc9b205 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml @@ -15,6 +15,7 @@ @* TODO: Can we use dynamic form? *@ + diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs index 25615aca94..0655331fb9 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.Domain.Entities; namespace Volo.Abp.Identity.Web.Pages.Identity.Users { @@ -54,11 +55,14 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users return NoContent(); } - public class UserInfoViewModel + public class UserInfoViewModel : IHasConcurrencyStamp { [HiddenInput] public Guid Id { get; set; } + [HiddenInput] + public string ConcurrencyStamp { get; set; } + [Required] [StringLength(IdentityUserConsts.MaxUserNameLength)] public string UserName { get; set; } diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs index 8801f7073a..d20294da5c 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs @@ -78,7 +78,10 @@ namespace Volo.Abp.Identity var input = new IdentityRoleUpdateDto { - Name = Guid.NewGuid().ToString("N").Left(8) + Name = Guid.NewGuid().ToString("N").Left(8), + ConcurrencyStamp = moderator.ConcurrencyStamp, + IsDefault = moderator.IsDefault, + IsPublic = moderator.IsPublic }; //Act diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs index 14864ce7da..c418c261ff 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using Shouldly; +using Volo.Abp.Data; using Xunit; namespace Volo.Abp.Identity @@ -9,11 +10,13 @@ namespace Volo.Abp.Identity { private readonly IIdentityUserAppService _userAppService; private readonly IIdentityUserRepository _userRepository; + private readonly IdentityTestData _testData; public IdentityUserAppService_Tests() { _userAppService = GetRequiredService(); _userRepository = GetRequiredService(); + _testData = GetRequiredService(); } [Fact] @@ -98,7 +101,10 @@ namespace Volo.Abp.Identity TwoFactorEnabled = true, PhoneNumber = CreateRandomPhoneNumber(), Email = CreateRandomEmail(), - RoleNames = new[] { "admin", "moderator" } + RoleNames = new[] { "admin", "moderator" }, + ConcurrencyStamp = johnNash.ConcurrencyStamp, + Surname = johnNash.Surname, + Name = johnNash.Name }; //Act @@ -122,6 +128,37 @@ namespace Volo.Abp.Identity user.Roles.Count.ShouldBe(2); } + + [Fact] + public async Task UpdateAsync_Concurrency_Exception() + { + //Get user + var johnNash = await _userAppService.GetAsync(_testData.UserJohnId); + + //Act + + var input = new IdentityUserUpdateDto + { + Name = "John-updated", + Surname = "Nash-updated", + UserName = johnNash.UserName, + LockoutEnabled = true, + TwoFactorEnabled = true, + PhoneNumber = CreateRandomPhoneNumber(), + Email = CreateRandomEmail(), + RoleNames = new[] { "admin", "moderator" }, + ConcurrencyStamp = johnNash.ConcurrencyStamp + }; + + await _userAppService.UpdateAsync(johnNash.Id, input); + + //Second update with same input will throw exception because the entity has been modified + (await Assert.ThrowsAsync(async () => + { + await _userAppService.UpdateAsync(johnNash.Id, input); + })).Message.ShouldContain("Optimistic concurrency failure"); + } + [Fact] public async Task DeleteAsync() { diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181114070127_Initial.Designer.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.Designer.cs similarity index 95% rename from templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181114070127_Initial.Designer.cs rename to templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.Designer.cs index 9abe09e5c4..8afbe89363 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181114070127_Initial.Designer.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.Designer.cs @@ -11,7 +11,7 @@ using Volo.Abp.BackgroundJobs; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameDbContext))] - [Migration("20181114070127_Initial")] + [Migration("20181212113826_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -43,6 +43,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("Comments") .HasMaxLength(256); + b.Property("ConcurrencyStamp"); + b.Property("Exceptions") .HasColumnName("Exceptions") .HasMaxLength(4000); @@ -221,9 +223,14 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Id") .ValueGeneratedOnAdd(); + b.Property("ConcurrencyStamp"); + b.Property("CreationTime") .HasColumnName("CreationTime"); + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + b.Property("IsAbandoned") .ValueGeneratedOnAdd() .HasDefaultValue(false); @@ -260,9 +267,18 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Id") .ValueGeneratedOnAdd(); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + b.Property("Description") .HasMaxLength(256); + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + b.Property("IsStatic"); b.Property("Name") @@ -289,7 +305,14 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Id") .ValueGeneratedOnAdd(); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); b.Property("IsDefault") .HasColumnName("IsDefault"); @@ -351,6 +374,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasDefaultValue(0); b.Property("ConcurrencyStamp") + .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") .HasMaxLength(256); diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181114070127_Initial.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.cs similarity index 97% rename from templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181114070127_Initial.cs rename to templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.cs index 01f4f9cd7f..5dd6559191 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181114070127_Initial.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.cs @@ -12,6 +12,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Id = table.Column(nullable: false), + ConcurrencyStamp = table.Column(nullable: true), UserId = table.Column(nullable: true), UserName = table.Column(maxLength: 256, nullable: true), TenantId = table.Column(nullable: true), @@ -39,6 +40,8 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), JobName = table.Column(maxLength: 128, nullable: false), JobArgs = table.Column(maxLength: 1048576, nullable: false), TryCount = table.Column(nullable: false, defaultValue: (short)0), @@ -58,6 +61,8 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), Name = table.Column(maxLength: 256, nullable: false), Required = table.Column(nullable: false), IsStatic = table.Column(nullable: false), @@ -91,10 +96,11 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), TenantId = table.Column(nullable: true), Name = table.Column(maxLength: 256, nullable: false), NormalizedName = table.Column(maxLength: 256, nullable: false), - ConcurrencyStamp = table.Column(nullable: true), IsDefault = table.Column(nullable: false), IsStatic = table.Column(nullable: false), IsPublic = table.Column(nullable: false) @@ -124,6 +130,8 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), CreationTime = table.Column(nullable: false), CreatorId = table.Column(nullable: true), LastModificationTime = table.Column(nullable: true), @@ -141,14 +149,12 @@ namespace MyCompanyName.MyProjectName.Migrations EmailConfirmed = table.Column(nullable: false, defaultValue: false), PasswordHash = table.Column(maxLength: 256, nullable: true), SecurityStamp = table.Column(maxLength: 256, nullable: false), - ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), PhoneNumber = table.Column(maxLength: 16, nullable: true), PhoneNumberConfirmed = table.Column(nullable: false, defaultValue: false), TwoFactorEnabled = table.Column(nullable: false, defaultValue: false), LockoutEnd = table.Column(nullable: true), LockoutEnabled = table.Column(nullable: false, defaultValue: false), - AccessFailedCount = table.Column(nullable: false, defaultValue: 0), - ExtraProperties = table.Column(nullable: true) + AccessFailedCount = table.Column(nullable: false, defaultValue: 0) }, constraints: table => { diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs index eff7489955..8a05ab5bc3 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs @@ -41,6 +41,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("Comments") .HasMaxLength(256); + b.Property("ConcurrencyStamp"); + b.Property("Exceptions") .HasColumnName("Exceptions") .HasMaxLength(4000); @@ -219,9 +221,14 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Id") .ValueGeneratedOnAdd(); + b.Property("ConcurrencyStamp"); + b.Property("CreationTime") .HasColumnName("CreationTime"); + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + b.Property("IsAbandoned") .ValueGeneratedOnAdd() .HasDefaultValue(false); @@ -258,9 +265,18 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Id") .ValueGeneratedOnAdd(); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + b.Property("Description") .HasMaxLength(256); + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + b.Property("IsStatic"); b.Property("Name") @@ -287,7 +303,14 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Id") .ValueGeneratedOnAdd(); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); b.Property("IsDefault") .HasColumnName("IsDefault"); @@ -349,6 +372,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasDefaultValue(0); b.Property("ConcurrencyStamp") + .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") .HasMaxLength(256); diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj index c3e54f4327..c393a58161 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj @@ -5,6 +5,10 @@ MyCompanyName.MyProjectName + + + +