Browse Source

Use optimistic concurrency in identity user and role edit. Apply migrations for the MVC template.

pull/652/head
Halil ibrahim Kalkan 8 years ago
parent
commit
431bfab0bc
  1. 3
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs
  2. 4
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs
  3. 6
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs
  4. 5
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleDto.cs
  5. 8
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleUpdateDto.cs
  6. 5
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs
  7. 7
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs
  8. 1
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs
  9. 1
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
  10. 10
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeConsts.cs
  11. 1
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs
  12. 8
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimType.cs
  13. 7
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs
  14. 3
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml
  15. 6
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs
  16. 1
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
  17. 6
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs
  18. 5
      modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs
  19. 39
      modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs
  20. 28
      templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.Designer.cs
  21. 14
      templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.cs
  22. 26
      templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs
  23. 4
      templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj

3
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();

4
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.
/// </summary>
public abstract class CrudAppServiceBase<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput, TUpdateInput> : ApplicationService
public abstract class CrudAppServiceBase<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput, TUpdateInput> :
ApplicationService
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{

6
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

5
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<Guid>
public class IdentityRoleDto : EntityDto<Guid>, 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; }
}
}

8
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; }
}
}

5
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<Guid>, IMultiTenant
public class IdentityUserDto : FullAuditedEntityDto<Guid>, 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; }
}
}

7
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; }
}
}

1
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs

@ -84,6 +84,7 @@ namespace Volo.Abp.Identity
public async Task<IdentityRoleDto> UpdateAsync(Guid id, IdentityRoleUpdateDto input)
{
var role = await _roleManager.GetByIdAsync(id);
role.ConcurrencyStamp = input.ConcurrencyStamp;
(await _roleManager.SetRoleNameAsync(role, input.Name)).CheckErrors();

1
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs

@ -72,6 +72,7 @@ namespace Volo.Abp.Identity
public async Task<IdentityUserDto> 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);

10
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;
}
}

1
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;
}
}

8
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<Guid>
public class IdentityClaimType : AggregateRoot<Guid>
{
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;
}
}
}

7
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));
});
}
}

3
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml

@ -12,9 +12,10 @@
<abp-modal-header title="@L["Edit"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="Role.Id" />
<abp-input asp-for="Role.ConcurrencyStamp" />
@if (Model.Role.IsStatic)
{
<abp-input asp-for="Role.Name" readonly="readonly" />
<abp-input asp-for="Role.Name" readonly="true" />
}
else
{

6
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")]

1
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml

@ -15,6 +15,7 @@
<abp-tab title="@L["UserInformations"].Value">
@* TODO: Can we use dynamic form? *@
<input asp-for="UserInfo.Id" />
<input asp-for="UserInfo.ConcurrencyStamp" />
<abp-input asp-for="UserInfo.UserName" />
<abp-input asp-for="UserInfo.Name" />
<abp-input asp-for="UserInfo.Surname" />

6
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; }

5
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

39
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<IIdentityUserAppService>();
_userRepository = GetRequiredService<IIdentityUserRepository>();
_testData = GetRequiredService<IdentityTestData>();
}
[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<AbpIdentityResultException>(async () =>
{
await _userAppService.UpdateAsync(johnNash.Id, input);
})).Message.ShouldContain("Optimistic concurrency failure");
}
[Fact]
public async Task DeleteAsync()
{

28
templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181114070127_Initial.Designer.cs → 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<string>("ConcurrencyStamp");
b.Property<string>("Exceptions")
.HasColumnName("Exceptions")
.HasMaxLength(4000);
@ -221,9 +223,14 @@ namespace MyCompanyName.MyProjectName.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsAbandoned")
.ValueGeneratedOnAdd()
.HasDefaultValue(false);
@ -260,9 +267,18 @@ namespace MyCompanyName.MyProjectName.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsStatic");
b.Property<string>("Name")
@ -289,7 +305,14 @@ namespace MyCompanyName.MyProjectName.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDefault")
.HasColumnName("IsDefault");
@ -351,6 +374,7 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);

14
templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181114070127_Initial.cs → templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.cs

@ -12,6 +12,7 @@ namespace MyCompanyName.MyProjectName.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
UserId = table.Column<Guid>(nullable: true),
UserName = table.Column<string>(maxLength: 256, nullable: true),
TenantId = table.Column<Guid>(nullable: true),
@ -39,6 +40,8 @@ namespace MyCompanyName.MyProjectName.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
JobName = table.Column<string>(maxLength: 128, nullable: false),
JobArgs = table.Column<string>(maxLength: 1048576, nullable: false),
TryCount = table.Column<short>(nullable: false, defaultValue: (short)0),
@ -58,6 +61,8 @@ namespace MyCompanyName.MyProjectName.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(maxLength: 256, nullable: false),
Name = table.Column<string>(maxLength: 256, nullable: false),
Required = table.Column<bool>(nullable: false),
IsStatic = table.Column<bool>(nullable: false),
@ -91,10 +96,11 @@ namespace MyCompanyName.MyProjectName.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(maxLength: 256, nullable: false),
TenantId = table.Column<Guid>(nullable: true),
Name = table.Column<string>(maxLength: 256, nullable: false),
NormalizedName = table.Column<string>(maxLength: 256, nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
IsDefault = table.Column<bool>(nullable: false),
IsStatic = table.Column<bool>(nullable: false),
IsPublic = table.Column<bool>(nullable: false)
@ -124,6 +130,8 @@ namespace MyCompanyName.MyProjectName.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(maxLength: 256, nullable: false),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
@ -141,14 +149,12 @@ namespace MyCompanyName.MyProjectName.Migrations
EmailConfirmed = table.Column<bool>(nullable: false, defaultValue: false),
PasswordHash = table.Column<string>(maxLength: 256, nullable: true),
SecurityStamp = table.Column<string>(maxLength: 256, nullable: false),
ConcurrencyStamp = table.Column<string>(maxLength: 256, nullable: false),
PhoneNumber = table.Column<string>(maxLength: 16, nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false, defaultValue: false),
TwoFactorEnabled = table.Column<bool>(nullable: false, defaultValue: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
LockoutEnabled = table.Column<bool>(nullable: false, defaultValue: false),
AccessFailedCount = table.Column<int>(nullable: false, defaultValue: 0),
ExtraProperties = table.Column<string>(nullable: true)
AccessFailedCount = table.Column<int>(nullable: false, defaultValue: 0)
},
constraints: table =>
{

26
templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs

@ -41,6 +41,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnName("Comments")
.HasMaxLength(256);
b.Property<string>("ConcurrencyStamp");
b.Property<string>("Exceptions")
.HasColumnName("Exceptions")
.HasMaxLength(4000);
@ -219,9 +221,14 @@ namespace MyCompanyName.MyProjectName.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsAbandoned")
.ValueGeneratedOnAdd()
.HasDefaultValue(false);
@ -258,9 +265,18 @@ namespace MyCompanyName.MyProjectName.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsStatic");
b.Property<string>("Name")
@ -287,7 +303,14 @@ namespace MyCompanyName.MyProjectName.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDefault")
.HasColumnName("IsDefault");
@ -349,6 +372,7 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);

4
templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj

@ -5,6 +5,10 @@
<RootNamespace>MyCompanyName.MyProjectName</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Migrations\20181114070127_Initial.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />

Loading…
Cancel
Save