Browse Source

Merge branch 'master' of https://github.com/volosoft/abp

pull/652/head
Alper Ebicoglu 8 years ago
parent
commit
a0262f2a71
  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. 3
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/AggregateRoot.cs
  4. 26
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs
  5. 107
      framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs
  6. 5
      framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpBsonClassMapExtensions.cs
  7. 9
      framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Domain/ConcurrencyStamp_Tests.cs
  8. 25
      framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ConcurrencyStamp_Tests.cs
  9. 54
      framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityChangeEvents_Tests.cs
  10. 3
      modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDomainAutoMapperProfile.cs
  11. 6
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs
  12. 5
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleDto.cs
  13. 8
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleUpdateDto.cs
  14. 5
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs
  15. 7
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs
  16. 1
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs
  17. 1
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
  18. 10
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeConsts.cs
  19. 1
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs
  20. 8
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimType.cs
  21. 7
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs
  22. 3
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml
  23. 6
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs
  24. 1
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
  25. 6
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs
  26. 5
      modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs
  27. 39
      modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs
  28. 2
      modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs
  29. 86
      templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20181212114934_Initial.Designer.cs
  30. 48
      templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20181212114934_Initial.cs
  31. 84
      templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/DemoAppDbContextModelSnapshot.cs
  32. 8
      templates/module/app/MyCompanyName.MyProjectName.DemoApp/MyCompanyName.MyProjectName.DemoApp.csproj
  33. 28
      templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.Designer.cs
  34. 14
      templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181212113826_Initial.cs
  35. 26
      templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs
  36. 4
      templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj
  37. 526
      templates/service/host/IdentityServerHost/Migrations/20181031075019_Initial.Designer.cs
  38. 252
      templates/service/host/IdentityServerHost/Migrations/20181031081104_Added_Identity.cs
  39. 74
      templates/service/host/IdentityServerHost/Migrations/20181212121034_Initial.Designer.cs
  40. 261
      templates/service/host/IdentityServerHost/Migrations/20181212121034_Initial.cs
  41. 70
      templates/service/host/IdentityServerHost/Migrations/DemoAppDbContextModelSnapshot.cs
  42. 4
      templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181212121232_Initial.Designer.cs
  43. 5
      templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181212121232_Initial.cs
  44. 2
      templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/DemoAppDbContextModelSnapshot.cs

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>
{

3
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/AggregateRoot.cs

@ -24,6 +24,7 @@ namespace Volo.Abp.Domain.Entities
protected AggregateRoot()
{
ExtraProperties = new Dictionary<string, object>();
ConcurrencyStamp = Guid.NewGuid().ToString("N");
}
protected virtual void AddLocalEvent(object eventData)
@ -75,12 +76,14 @@ namespace Volo.Abp.Domain.Entities
protected AggregateRoot()
{
ExtraProperties = new Dictionary<string, object>();
ConcurrencyStamp = Guid.NewGuid().ToString("N");
}
protected AggregateRoot(TKey id)
: base(id)
{
ExtraProperties = new Dictionary<string, object>();
ConcurrencyStamp = Guid.NewGuid().ToString("N");
}
protected virtual void AddLocalEvent(object eventData)

26
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs

@ -201,13 +201,14 @@ namespace Volo.Abp.EntityFrameworkCore
protected virtual void ApplyAbpConceptsForAddedEntity(EntityEntry entry, EntityChangeReport changeReport)
{
CheckAndSetId(entry);
SetConcurrencyStampIfNull(entry);
SetCreationAuditProperties(entry);
changeReport.ChangedEntities.Add(new EntityChangeEntry(entry.Entity, EntityChangeType.Created));
}
protected virtual void ApplyAbpConceptsForModifiedEntity(EntityEntry entry, EntityChangeReport changeReport)
{
HandleConcurrencyStamp(entry);
UpdateConcurrencyStamp(entry);
SetModificationAuditProperties(entry);
if (entry.Entity is ISoftDelete && entry.Entity.As<ISoftDelete>().IsDeleted)
@ -224,7 +225,7 @@ namespace Volo.Abp.EntityFrameworkCore
protected virtual void ApplyAbpConceptsForDeletedEntity(EntityEntry entry, EntityChangeReport changeReport)
{
CancelDeletionForSoftDelete(entry);
HandleConcurrencyStamp(entry);
UpdateConcurrencyStamp(entry);
SetDeletionAuditProperties(entry);
changeReport.ChangedEntities.Add(new EntityChangeEntry(entry.Entity, EntityChangeType.Deleted));
}
@ -252,7 +253,7 @@ namespace Volo.Abp.EntityFrameworkCore
}
}
protected virtual void HandleConcurrencyStamp(EntityEntry entry)
protected virtual void UpdateConcurrencyStamp(EntityEntry entry)
{
var entity = entry.Entity as IHasConcurrencyStamp;
if (entity == null)
@ -260,7 +261,24 @@ namespace Volo.Abp.EntityFrameworkCore
return;
}
entity.ConcurrencyStamp = Guid.NewGuid().ToString();
Entry(entity).Property(x => x.ConcurrencyStamp).OriginalValue = entity.ConcurrencyStamp;
entity.ConcurrencyStamp = Guid.NewGuid().ToString("N");
}
protected virtual void SetConcurrencyStampIfNull(EntityEntry entry)
{
var entity = entry.Entity as IHasConcurrencyStamp;
if (entity == null)
{
return;
}
if (entity.ConcurrencyStamp != null)
{
return;
}
entity.ConcurrencyStamp = Guid.NewGuid().ToString("N");
}
protected virtual void CancelDeletionForSoftDelete(EntityEntry entry)

107
framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs

@ -1,15 +1,15 @@
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.EventBus.Local;
using Volo.Abp.Guids;
@ -97,11 +97,18 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
AsyncHelper.RunSync(() => TriggerDomainEventsAsync(entity));
Collection.ReplaceOne(
CreateEntityFilter(entity),
var oldConcurrencyStamp = SetNewConcurrencyStamp(entity);
var result = Collection.ReplaceOne(
CreateEntityFilter(entity, true, oldConcurrencyStamp),
entity
);
if (result.MatchedCount <= 0)
{
ThrowOptimisticConcurrencyException();
}
return entity;
}
@ -124,32 +131,50 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
await TriggerDomainEventsAsync(entity);
await Collection.ReplaceOneAsync(
CreateEntityFilter(entity),
var oldConcurrencyStamp = SetNewConcurrencyStamp(entity);
var result = await Collection.ReplaceOneAsync(
CreateEntityFilter(entity, true, oldConcurrencyStamp),
entity,
cancellationToken: GetCancellationToken(cancellationToken)
);
if (result.MatchedCount <= 0)
{
ThrowOptimisticConcurrencyException();
}
return entity;
}
public override void Delete(TEntity entity, bool autoSave = false)
{
AsyncHelper.RunSync(() => ApplyAbpConceptsForDeletedEntityAsync(entity));
var oldConcurrencyStamp = SetNewConcurrencyStamp(entity);
if (entity is ISoftDelete softDeleteEntity)
{
softDeleteEntity.IsDeleted = true;
Collection.ReplaceOne(
CreateEntityFilter(entity),
var result = Collection.ReplaceOne(
CreateEntityFilter(entity, true, oldConcurrencyStamp),
entity
);
if (result.MatchedCount <= 0)
{
ThrowOptimisticConcurrencyException();
}
}
else
{
Collection.DeleteOne(
CreateEntityFilter(entity)
var result = Collection.DeleteOne(
CreateEntityFilter(entity, true, oldConcurrencyStamp)
);
if (result.DeletedCount <= 0)
{
ThrowOptimisticConcurrencyException();
}
}
}
@ -159,22 +184,33 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
CancellationToken cancellationToken = default)
{
await ApplyAbpConceptsForDeletedEntityAsync(entity);
var oldConcurrencyStamp = SetNewConcurrencyStamp(entity);
if (entity is ISoftDelete softDeleteEntity)
{
softDeleteEntity.IsDeleted = true;
await Collection.ReplaceOneAsync(
CreateEntityFilter(entity),
var result = await Collection.ReplaceOneAsync(
CreateEntityFilter(entity, true, oldConcurrencyStamp),
entity,
cancellationToken: GetCancellationToken(cancellationToken)
);
if (result.MatchedCount <= 0)
{
ThrowOptimisticConcurrencyException();
}
}
else
{
await Collection.DeleteOneAsync(
CreateEntityFilter(entity),
var result = await Collection.DeleteOneAsync(
CreateEntityFilter(entity, true, oldConcurrencyStamp),
GetCancellationToken(cancellationToken)
);
if (result.DeletedCount <= 0)
{
ThrowOptimisticConcurrencyException();
}
}
}
@ -239,7 +275,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
);
}
protected virtual FilterDefinition<TEntity> CreateEntityFilter(TEntity entity)
protected virtual FilterDefinition<TEntity> CreateEntityFilter(TEntity entity, bool withConcurrencyStamp = false, string concurrencyStamp = null)
{
throw new NotImplementedException(
$"{nameof(CreateEntityFilter)} is not implemented for MongoDB by default. It should be overrided and implemented by the deriving class!"
@ -332,6 +368,28 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
generatesDomainEventsEntity.ClearDistributedEvents();
}
}
/// <summary>
/// Sets a new <see cref="IHasConcurrencyStamp.ConcurrencyStamp"/> value
/// if given entity implements <see cref="IHasConcurrencyStamp"/> interface.
/// Returns the old <see cref="IHasConcurrencyStamp.ConcurrencyStamp"/> value.
/// </summary>
protected virtual string SetNewConcurrencyStamp(TEntity entity)
{
if (!(entity is IHasConcurrencyStamp concurrencyStampEntity))
{
return null;
}
var oldConcurrencyStamp = concurrencyStampEntity.ConcurrencyStamp;
concurrencyStampEntity.ConcurrencyStamp = Guid.NewGuid().ToString("N");
return oldConcurrencyStamp;
}
protected virtual void ThrowOptimisticConcurrencyException()
{
throw new AbpDbConcurrencyException("Database operation expected to affect 1 row but actually affected 0 row. Data may have been modified or deleted since entities were loaded. This exception has been thrown on optimistic concurrency check.");
}
}
public class MongoDbRepository<TMongoDbContext, TEntity, TKey>
@ -404,9 +462,22 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
);
}
protected override FilterDefinition<TEntity> CreateEntityFilter(TEntity entity)
protected override FilterDefinition<TEntity> CreateEntityFilter(TEntity entity, bool withConcurrencyStamp = false, string concurrencyStamp = null)
{
return Builders<TEntity>.Filter.Eq(e => e.Id, entity.Id);
if (!withConcurrencyStamp || !(entity is IHasConcurrencyStamp entityWithConcurrencyStamp))
{
return Builders<TEntity>.Filter.Eq(e => e.Id, entity.Id);
}
if (concurrencyStamp == null)
{
concurrencyStamp = entityWithConcurrencyStamp.ConcurrencyStamp;
}
return Builders<TEntity>.Filter.And(
Builders<TEntity>.Filter.Eq(e => e.Id, entity.Id),
Builders<TEntity>.Filter.Eq(e => ((IHasConcurrencyStamp)e).ConcurrencyStamp, concurrencyStamp)
);
}
protected virtual FilterDefinition<TEntity> CreateEntityFilter(TKey id, bool applyFilters = false)

5
framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpBsonClassMapExtensions.cs

@ -8,7 +8,10 @@ namespace Volo.Abp.MongoDB
public static void ConfigureExtraProperties<T>(this BsonClassMap<T> map)
where T : class, IHasExtraProperties
{
map.MapExtraElementsProperty(x => x.ExtraProperties);
map.SetExtraElementsMember(new BsonMemberMap(
map,
typeof(T).GetMember(nameof(IHasExtraProperties.ExtraProperties))[0])
);
}
}
}

9
framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Domain/ConcurrencyStamp_Tests.cs

@ -0,0 +1,9 @@
using Volo.Abp.TestApp.Testing;
namespace Volo.Abp.MongoDB.Domain
{
public class ConcurrencyStamp_Tests : ConcurrencyStamp_Tests<AbpMongoDbTestModule>
{
}
}

25
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ConcurrencyStamp_Tests.cs

@ -6,12 +6,12 @@ using Xunit;
namespace Volo.Abp.TestApp.Testing
{
public class ConcurrencyStamp_Tests<TStartupModule> : TestAppTestBase<TStartupModule>
public abstract class ConcurrencyStamp_Tests<TStartupModule> : TestAppTestBase<TStartupModule>
where TStartupModule : IAbpModule
{
protected readonly ICityRepository CityRepository;
public ConcurrencyStamp_Tests()
protected ConcurrencyStamp_Tests()
{
CityRepository = GetRequiredService<ICityRepository>();
}
@ -19,17 +19,38 @@ namespace Volo.Abp.TestApp.Testing
[Fact]
public async Task Should_Not_Allow_To_Update_If_The_Entity_Has_Changed()
{
//Got an entity from database, changed its value, but not updated in the database yet
var london1 = await CityRepository.FindByNameAsync("London");
london1.Name = "London-1";
//Another user has changed it just before I update
var london2 = await CityRepository.FindByNameAsync("London");
london2.Name = "London-2";
await CityRepository.UpdateAsync(london2);
//And updating my old entity throws exception!
await Assert.ThrowsAsync<AbpDbConcurrencyException>(async () =>
{
await CityRepository.UpdateAsync(london1);
});
}
[Fact]
public async Task Should_Not_Allow_To_Delete_If_The_Entity_Has_Changed()
{
//Got an entity from database, but not deleted in the database yet
var london1 = await CityRepository.FindByNameAsync("London");
//Another user has changed it just before I delete
var london2 = await CityRepository.FindByNameAsync("London");
london2.Name = "London-updated";
await CityRepository.UpdateAsync(london2);
//And deleting my old entity throws exception!
await Assert.ThrowsAsync<AbpDbConcurrencyException>(async () =>
{
await CityRepository.DeleteAsync(london1);
});
}
}
}

54
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityChangeEvents_Tests.cs

@ -35,9 +35,6 @@ namespace Volo.Abp.TestApp.Testing
var creatingEventTriggered = false;
var createdEventTriggered = false;
var createdEtoTriggered = false;
var updatedEtoTriggered = false;
var updatingEventTriggered = false;
var updatedEventTriggered = false;
using (var uow = GetRequiredService<IUnitOfWorkManager>().Begin())
{
@ -45,18 +42,14 @@ namespace Volo.Abp.TestApp.Testing
{
creatingEventTriggered.ShouldBeFalse();
createdEventTriggered.ShouldBeFalse();
updatingEventTriggered.ShouldBeFalse();
updatedEventTriggered.ShouldBeFalse();
creatingEventTriggered = true;
data.Entity.Name.ShouldBe(personName);
/* Want to change age from 15 to 18
* Expect to trigger EntityUpdatingEventData, EntityUpdatedEventData events */
/* Want to change age from 15 to 18 */
data.Entity.Age.ShouldBe(15);
data.Entity.Age = 18;
PersonRepository.Update(data.Entity);
return Task.CompletedTask;
});
@ -64,8 +57,6 @@ namespace Volo.Abp.TestApp.Testing
{
creatingEventTriggered.ShouldBeTrue();
createdEventTriggered.ShouldBeFalse();
updatingEventTriggered.ShouldBeTrue();
updatedEventTriggered.ShouldBeFalse();
createdEventTriggered = true;
@ -84,46 +75,6 @@ namespace Volo.Abp.TestApp.Testing
return Task.CompletedTask;
});
LocalEventBus.Subscribe<EntityUpdatingEventData<Person>>(data =>
{
creatingEventTriggered.ShouldBeTrue();
createdEventTriggered.ShouldBeFalse();
updatingEventTriggered.ShouldBeFalse();
updatedEventTriggered.ShouldBeFalse();
updatingEventTriggered = true;
data.Entity.Name.ShouldBe(personName);
data.Entity.Age.ShouldBe(18);
return Task.CompletedTask;
});
LocalEventBus.Subscribe<EntityUpdatedEventData<Person>>(data =>
{
creatingEventTriggered.ShouldBeTrue();
createdEventTriggered.ShouldBeTrue();
updatingEventTriggered.ShouldBeTrue();
updatedEventTriggered.ShouldBeFalse();
updatedEventTriggered = true;
data.Entity.Name.ShouldBe(personName);
data.Entity.Age.ShouldBe(18);
return Task.CompletedTask;
});
DistributedEventBus.Subscribe<EntityUpdatedEto<PersonEto>>(eto =>
{
eto.Entity.Name.ShouldBe(personName);
eto.Entity.Age.ShouldBe(18);
updatedEtoTriggered = true;
return Task.CompletedTask;
});
PersonRepository.Insert(new Person(Guid.NewGuid(), personName, 15));
uow.Complete();
@ -132,9 +83,6 @@ namespace Volo.Abp.TestApp.Testing
creatingEventTriggered.ShouldBeTrue();
createdEventTriggered.ShouldBeTrue();
createdEtoTriggered.ShouldBeTrue();
updatingEventTriggered.ShouldBeTrue();
updatedEventTriggered.ShouldBeTrue();
updatedEtoTriggered.ShouldBeTrue();
}
}
}

3
modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDomainAutoMapperProfile.cs

@ -1,4 +1,5 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
namespace Volo.Abp.BackgroundJobs
{
@ -7,6 +8,8 @@ namespace Volo.Abp.BackgroundJobs
public BackgroundJobsDomainAutoMapperProfile()
{
CreateMap<BackgroundJobInfo, BackgroundJobRecord>()
.Ignore(record => record.ConcurrencyStamp)
.Ignore(record => record.ExtraProperties)
.ReverseMap();
}
}

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()
{

2
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpIdentityWebMainMenuContributor.cs → modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs

@ -28,4 +28,4 @@ namespace Volo.Abp.TenantManagement.Web.Navigation
}
}
}
}
}

86
templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20180711153639_Initial.Designer.cs → templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20181212114934_Initial.Designer.cs

@ -10,7 +10,7 @@ using MyCompanyName.MyProjectName.DemoApp;
namespace MyCompanyName.MyProjectName.DemoApp.Migrations
{
[DbContext(typeof(DemoAppDbContext))]
[Migration("20180711153639_Initial")]
[Migration("20181212114934_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -21,12 +21,66 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
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")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("Regex")
.HasMaxLength(512);
b.Property<string>("RegexDescription")
.HasMaxLength(128);
b.Property<bool>("Required");
b.Property<int>("ValueType");
b.HasKey("Id");
b.ToTable("AbpClaimTypes");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{
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");
b.Property<bool>("IsPublic")
.HasColumnName("IsPublic");
b.Property<bool>("IsStatic")
.HasColumnName("IsStatic");
b.Property<string>("Name")
.IsRequired()
@ -79,10 +133,19 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("DeleterId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
@ -95,6 +158,12 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled")
@ -102,6 +171,10 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail")
.HasColumnName("NormalizedEmail")
.HasMaxLength(256);
@ -129,6 +202,10 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
.HasColumnName("SecurityStamp")
.HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
@ -221,9 +298,10 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
b.Property<Guid>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(128);
.HasMaxLength(64);
b.Property<string>("Name");
b.Property<string>("Name")
.HasMaxLength(128);
b.Property<Guid?>("TenantId");

48
templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20180711153639_Initial.cs → templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20181212114934_Initial.cs

@ -7,6 +7,26 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpClaimTypes",
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),
Regex = table.Column<string>(maxLength: 512, nullable: true),
RegexDescription = table.Column<string>(maxLength: 128, nullable: true),
Description = table.Column<string>(maxLength: 256, nullable: true),
ValueType = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpPermissionGrants",
columns: table => new
@ -27,10 +47,14 @@ namespace MyCompanyName.MyProjectName.DemoApp.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)
},
constraints: table =>
{
@ -57,22 +81,31 @@ namespace MyCompanyName.MyProjectName.DemoApp.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),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
TenantId = table.Column<Guid>(nullable: true),
UserName = table.Column<string>(maxLength: 256, nullable: false),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: false),
Name = table.Column<string>(maxLength: 64, nullable: true),
Surname = table.Column<string>(maxLength: 64, nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
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 =>
{
@ -173,8 +206,8 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
{
TenantId = table.Column<Guid>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(maxLength: 128, nullable: false),
Name = table.Column<string>(nullable: false),
LoginProvider = table.Column<string>(maxLength: 64, nullable: false),
Name = table.Column<string>(maxLength: 128, nullable: false),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
@ -246,6 +279,9 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpClaimTypes");
migrationBuilder.DropTable(
name: "AbpPermissionGrants");

84
templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/DemoAppDbContextModelSnapshot.cs

@ -19,12 +19,66 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
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")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("Regex")
.HasMaxLength(512);
b.Property<string>("RegexDescription")
.HasMaxLength(128);
b.Property<bool>("Required");
b.Property<int>("ValueType");
b.HasKey("Id");
b.ToTable("AbpClaimTypes");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{
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");
b.Property<bool>("IsPublic")
.HasColumnName("IsPublic");
b.Property<bool>("IsStatic")
.HasColumnName("IsStatic");
b.Property<string>("Name")
.IsRequired()
@ -77,10 +131,19 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("DeleterId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
@ -93,6 +156,12 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled")
@ -100,6 +169,10 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail")
.HasColumnName("NormalizedEmail")
.HasMaxLength(256);
@ -127,6 +200,10 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
.HasColumnName("SecurityStamp")
.HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
@ -219,9 +296,10 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
b.Property<Guid>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(128);
.HasMaxLength(64);
b.Property<string>("Name");
b.Property<string>("Name")
.HasMaxLength(128);
b.Property<Guid?>("TenantId");

8
templates/module/app/MyCompanyName.MyProjectName.DemoApp/MyCompanyName.MyProjectName.DemoApp.csproj

@ -33,12 +33,4 @@
<None Remove="Logs\**" />
</ItemGroup>
<ItemGroup>
<Content Remove="Pages\_ViewImports.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\_ViewImports.cshtml" />
</ItemGroup>
</Project>

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" />

526
templates/service/host/IdentityServerHost/Migrations/20181031075019_Initial.Designer.cs

@ -1,526 +0,0 @@
// <auto-generated />
using System;
using IdentityServerHost;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace IdentityServerHost.Migrations
{
[DbContext(typeof(DemoAppDbContext))]
[Migration("20181031075019_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Enabled");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.ToTable("IdentityServerApiResources");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("ApiResourceId", "Type");
b.ToTable("IdentityServerApiClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Name")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<string>("DisplayName")
.HasMaxLength(128);
b.Property<bool>("Emphasize");
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("ApiResourceId", "Name");
b.ToTable("IdentityServerApiScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Name")
.HasMaxLength(196);
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("ApiResourceId", "Name", "Type");
b.ToTable("IdentityServerApiScopeClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Type")
.HasMaxLength(32);
b.Property<string>("Value")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<DateTime?>("Expiration");
b.HasKey("ApiResourceId", "Type", "Value");
b.ToTable("IdentityServerApiSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AbsoluteRefreshTokenLifetime");
b.Property<int>("AccessTokenLifetime");
b.Property<int>("AccessTokenType");
b.Property<bool>("AllowAccessTokensViaBrowser");
b.Property<bool>("AllowOfflineAccess");
b.Property<bool>("AllowPlainTextPkce");
b.Property<bool>("AllowRememberConsent");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken");
b.Property<bool>("AlwaysSendClientClaims");
b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri")
.HasMaxLength(2000);
b.Property<string>("ClientClaimsPrefix")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasMaxLength(2000);
b.Property<int?>("ConsentLifetime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<bool>("EnableLocalLogin");
b.Property<bool>("Enabled");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri")
.HasMaxLength(2000);
b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId");
b.Property<string>("LogoUri")
.HasMaxLength(2000);
b.Property<string>("PairWiseSubjectSalt")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration");
b.Property<int>("RefreshTokenUsage");
b.Property<bool>("RequireClientSecret");
b.Property<bool>("RequireConsent");
b.Property<bool>("RequirePkce");
b.Property<int>("SlidingRefreshTokenLifetime");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("IdentityServerClients");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("IdentityServerClientClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Origin")
.HasMaxLength(150);
b.HasKey("ClientId", "Origin");
b.ToTable("IdentityServerClientCorsOrigins");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("GrantType")
.HasMaxLength(196);
b.HasKey("ClientId", "GrantType");
b.ToTable("IdentityServerClientGrantTypes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Provider")
.HasMaxLength(64);
b.HasKey("ClientId", "Provider");
b.ToTable("IdentityServerClientIdPRestrictions");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("PostLogoutRedirectUri")
.HasMaxLength(2000);
b.HasKey("ClientId", "PostLogoutRedirectUri");
b.ToTable("IdentityServerClientPostLogoutRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Key")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("ClientId", "Key");
b.ToTable("IdentityServerClientProperties");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("RedirectUri")
.HasMaxLength(2000);
b.HasKey("ClientId", "RedirectUri");
b.ToTable("IdentityServerClientRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Scope")
.HasMaxLength(196);
b.HasKey("ClientId", "Scope");
b.ToTable("IdentityServerClientScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Type")
.HasMaxLength(32);
b.Property<string>("Value")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<DateTime?>("Expiration");
b.HasKey("ClientId", "Type", "Value");
b.ToTable("IdentityServerClientSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<DateTime>("CreationTime");
b.Property<string>("Data")
.IsRequired();
b.Property<DateTime?>("Expiration");
b.Property<Guid>("Id");
b.Property<string>("SubjectId")
.HasMaxLength(200);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50);
b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type");
b.ToTable("IdentityServerPersistedGrants");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.Property<Guid>("IdentityResourceId");
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("IdentityResourceId", "Type");
b.ToTable("IdentityServerIdentityClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Emphasize");
b.Property<bool>("Enabled");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("Id");
b.ToTable("IdentityServerIdentityResources");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId", "Name")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

252
templates/service/host/IdentityServerHost/Migrations/20181031081104_Added_Identity.cs

@ -1,252 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace IdentityServerHost.Migrations
{
public partial class Added_Identity : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpClaimTypes",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
Name = table.Column<string>(maxLength: 256, nullable: false),
Required = table.Column<bool>(nullable: false),
IsStatic = table.Column<bool>(nullable: false),
Regex = table.Column<string>(maxLength: 512, nullable: true),
RegexDescription = table.Column<string>(maxLength: 128, nullable: true),
Description = table.Column<string>(maxLength: 256, nullable: true),
ValueType = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpRoles",
columns: table => new
{
Id = table.Column<Guid>(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)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpUsers",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
UserName = table.Column<string>(maxLength: 256, nullable: false),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: false),
Email = table.Column<string>(maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
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)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpRoleClaims",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
ClaimType = table.Column<string>(maxLength: 256, nullable: false),
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true),
RoleId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AbpRoleClaims_AbpRoles_RoleId",
column: x => x.RoleId,
principalTable: "AbpRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserClaims",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
ClaimType = table.Column<string>(maxLength: 256, nullable: false),
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true),
UserId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_AbpUserClaims_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserLogins",
columns: table => new
{
TenantId = table.Column<Guid>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(maxLength: 64, nullable: false),
ProviderKey = table.Column<string>(maxLength: 196, nullable: false),
ProviderDisplayName = table.Column<string>(maxLength: 128, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider });
table.ForeignKey(
name: "FK_AbpUserLogins_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserRoles",
columns: table => new
{
TenantId = table.Column<Guid>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
RoleId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AbpUserRoles_AbpRoles_RoleId",
column: x => x.RoleId,
principalTable: "AbpRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AbpUserRoles_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserTokens",
columns: table => new
{
TenantId = table.Column<Guid>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(maxLength: 64, nullable: false),
Name = table.Column<string>(maxLength: 128, nullable: false),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AbpUserTokens_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AbpRoleClaims_RoleId",
table: "AbpRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_AbpRoles_NormalizedName",
table: "AbpRoles",
column: "NormalizedName");
migrationBuilder.CreateIndex(
name: "IX_AbpUserClaims_UserId",
table: "AbpUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AbpUserLogins_LoginProvider_ProviderKey",
table: "AbpUserLogins",
columns: new[] { "LoginProvider", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_AbpUserRoles_RoleId_UserId",
table: "AbpUserRoles",
columns: new[] { "RoleId", "UserId" });
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_Email",
table: "AbpUsers",
column: "Email");
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_NormalizedEmail",
table: "AbpUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_NormalizedUserName",
table: "AbpUsers",
column: "NormalizedUserName");
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_UserName",
table: "AbpUsers",
column: "UserName");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpClaimTypes");
migrationBuilder.DropTable(
name: "AbpRoleClaims");
migrationBuilder.DropTable(
name: "AbpUserClaims");
migrationBuilder.DropTable(
name: "AbpUserLogins");
migrationBuilder.DropTable(
name: "AbpUserRoles");
migrationBuilder.DropTable(
name: "AbpUserTokens");
migrationBuilder.DropTable(
name: "AbpRoles");
migrationBuilder.DropTable(
name: "AbpUsers");
}
}
}

74
templates/service/host/IdentityServerHost/Migrations/20181031081104_Added_Identity.Designer.cs → templates/service/host/IdentityServerHost/Migrations/20181212121034_Initial.Designer.cs

@ -10,8 +10,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace IdentityServerHost.Migrations
{
[DbContext(typeof(DemoAppDbContext))]
[Migration("20181031081104_Added_Identity")]
partial class Added_Identity
[Migration("20181212121034_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@ -26,9 +26,18 @@ namespace IdentityServerHost.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")
@ -55,7 +64,23 @@ namespace IdentityServerHost.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");
b.Property<bool>("IsPublic")
.HasColumnName("IsPublic");
b.Property<bool>("IsStatic")
.HasColumnName("IsStatic");
b.Property<string>("Name")
.IsRequired()
@ -108,10 +133,19 @@ namespace IdentityServerHost.Migrations
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("DeleterId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
@ -124,6 +158,12 @@ namespace IdentityServerHost.Migrations
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled")
@ -131,6 +171,10 @@ namespace IdentityServerHost.Migrations
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail")
.HasColumnName("NormalizedEmail")
.HasMaxLength(256);
@ -158,6 +202,10 @@ namespace IdentityServerHost.Migrations
.HasColumnName("SecurityStamp")
.HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
@ -269,6 +317,8 @@ namespace IdentityServerHost.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<string>("Description")
.HasMaxLength(1000);
@ -277,6 +327,9 @@ namespace IdentityServerHost.Migrations
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
@ -400,6 +453,8 @@ namespace IdentityServerHost.Migrations
b.Property<string>("ClientUri")
.HasMaxLength(2000);
b.Property<string>("ConcurrencyStamp");
b.Property<int?>("ConsentLifetime");
b.Property<string>("Description")
@ -409,6 +464,9 @@ namespace IdentityServerHost.Migrations
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri")
@ -589,6 +647,8 @@ namespace IdentityServerHost.Migrations
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime");
b.Property<string>("Data")
@ -596,6 +656,9 @@ namespace IdentityServerHost.Migrations
b.Property<DateTime?>("Expiration");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<Guid>("Id");
b.Property<string>("SubjectId")
@ -629,6 +692,8 @@ namespace IdentityServerHost.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<string>("Description")
.HasMaxLength(1000);
@ -639,6 +704,9 @@ namespace IdentityServerHost.Migrations
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);

261
templates/service/host/IdentityServerHost/Migrations/20181031075019_Initial.cs → templates/service/host/IdentityServerHost/Migrations/20181212121034_Initial.cs

@ -7,11 +7,88 @@ namespace IdentityServerHost.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpClaimTypes",
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),
Regex = table.Column<string>(maxLength: 512, nullable: true),
RegexDescription = table.Column<string>(maxLength: 128, nullable: true),
Description = table.Column<string>(maxLength: 256, nullable: true),
ValueType = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpRoles",
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),
IsDefault = table.Column<bool>(nullable: false),
IsStatic = table.Column<bool>(nullable: false),
IsPublic = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpUsers",
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),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
TenantId = table.Column<Guid>(nullable: true),
UserName = table.Column<string>(maxLength: 256, nullable: false),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: false),
Name = table.Column<string>(maxLength: 64, nullable: true),
Surname = table.Column<string>(maxLength: 64, nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false, defaultValue: false),
PasswordHash = table.Column<string>(maxLength: 256, nullable: true),
SecurityStamp = 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)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "IdentityServerApiResources",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
Name = table.Column<string>(maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
@ -27,6 +104,8 @@ namespace IdentityServerHost.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
ClientId = table.Column<string>(maxLength: 200, nullable: false),
ClientName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
@ -72,6 +151,8 @@ namespace IdentityServerHost.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
Name = table.Column<string>(maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
@ -90,6 +171,8 @@ namespace IdentityServerHost.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
Key = table.Column<string>(maxLength: 200, nullable: false),
Type = table.Column<string>(maxLength: 50, nullable: false),
SubjectId = table.Column<string>(maxLength: 200, nullable: true),
@ -103,6 +186,115 @@ namespace IdentityServerHost.Migrations
table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key);
});
migrationBuilder.CreateTable(
name: "AbpRoleClaims",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
ClaimType = table.Column<string>(maxLength: 256, nullable: false),
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true),
RoleId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AbpRoleClaims_AbpRoles_RoleId",
column: x => x.RoleId,
principalTable: "AbpRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserClaims",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
ClaimType = table.Column<string>(maxLength: 256, nullable: false),
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true),
UserId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_AbpUserClaims_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserLogins",
columns: table => new
{
TenantId = table.Column<Guid>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(maxLength: 64, nullable: false),
ProviderKey = table.Column<string>(maxLength: 196, nullable: false),
ProviderDisplayName = table.Column<string>(maxLength: 128, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider });
table.ForeignKey(
name: "FK_AbpUserLogins_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserRoles",
columns: table => new
{
TenantId = table.Column<Guid>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
RoleId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AbpUserRoles_AbpRoles_RoleId",
column: x => x.RoleId,
principalTable: "AbpRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AbpUserRoles_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserTokens",
columns: table => new
{
TenantId = table.Column<Guid>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(maxLength: 64, nullable: false),
Name = table.Column<string>(maxLength: 128, nullable: false),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AbpUserTokens_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerApiClaims",
columns: table => new
@ -370,6 +562,51 @@ namespace IdentityServerHost.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AbpRoleClaims_RoleId",
table: "AbpRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_AbpRoles_NormalizedName",
table: "AbpRoles",
column: "NormalizedName");
migrationBuilder.CreateIndex(
name: "IX_AbpUserClaims_UserId",
table: "AbpUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AbpUserLogins_LoginProvider_ProviderKey",
table: "AbpUserLogins",
columns: new[] { "LoginProvider", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_AbpUserRoles_RoleId_UserId",
table: "AbpUserRoles",
columns: new[] { "RoleId", "UserId" });
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_Email",
table: "AbpUsers",
column: "Email");
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_NormalizedEmail",
table: "AbpUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_NormalizedUserName",
table: "AbpUsers",
column: "NormalizedUserName");
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_UserName",
table: "AbpUsers",
column: "UserName");
migrationBuilder.CreateIndex(
name: "IX_IdentityServerClientClaims_ClientId",
table: "IdentityServerClientClaims",
@ -389,6 +626,24 @@ namespace IdentityServerHost.Migrations
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpClaimTypes");
migrationBuilder.DropTable(
name: "AbpRoleClaims");
migrationBuilder.DropTable(
name: "AbpUserClaims");
migrationBuilder.DropTable(
name: "AbpUserLogins");
migrationBuilder.DropTable(
name: "AbpUserRoles");
migrationBuilder.DropTable(
name: "AbpUserTokens");
migrationBuilder.DropTable(
name: "IdentityServerApiClaims");
@ -431,6 +686,12 @@ namespace IdentityServerHost.Migrations
migrationBuilder.DropTable(
name: "IdentityServerPersistedGrants");
migrationBuilder.DropTable(
name: "AbpRoles");
migrationBuilder.DropTable(
name: "AbpUsers");
migrationBuilder.DropTable(
name: "IdentityServerApiScopes");

70
templates/service/host/IdentityServerHost/Migrations/DemoAppDbContextModelSnapshot.cs

@ -24,9 +24,18 @@ namespace IdentityServerHost.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")
@ -53,7 +62,23 @@ namespace IdentityServerHost.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");
b.Property<bool>("IsPublic")
.HasColumnName("IsPublic");
b.Property<bool>("IsStatic")
.HasColumnName("IsStatic");
b.Property<string>("Name")
.IsRequired()
@ -106,10 +131,19 @@ namespace IdentityServerHost.Migrations
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("DeleterId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
@ -122,6 +156,12 @@ namespace IdentityServerHost.Migrations
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled")
@ -129,6 +169,10 @@ namespace IdentityServerHost.Migrations
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail")
.HasColumnName("NormalizedEmail")
.HasMaxLength(256);
@ -156,6 +200,10 @@ namespace IdentityServerHost.Migrations
.HasColumnName("SecurityStamp")
.HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
@ -267,6 +315,8 @@ namespace IdentityServerHost.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<string>("Description")
.HasMaxLength(1000);
@ -275,6 +325,9 @@ namespace IdentityServerHost.Migrations
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
@ -398,6 +451,8 @@ namespace IdentityServerHost.Migrations
b.Property<string>("ClientUri")
.HasMaxLength(2000);
b.Property<string>("ConcurrencyStamp");
b.Property<int?>("ConsentLifetime");
b.Property<string>("Description")
@ -407,6 +462,9 @@ namespace IdentityServerHost.Migrations
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri")
@ -587,6 +645,8 @@ namespace IdentityServerHost.Migrations
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime");
b.Property<string>("Data")
@ -594,6 +654,9 @@ namespace IdentityServerHost.Migrations
b.Property<DateTime?>("Expiration");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<Guid>("Id");
b.Property<string>("SubjectId")
@ -627,6 +690,8 @@ namespace IdentityServerHost.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<string>("Description")
.HasMaxLength(1000);
@ -637,6 +702,9 @@ namespace IdentityServerHost.Migrations
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);

4
templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181030142530_Initial.Designer.cs → templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181212121232_Initial.Designer.cs

@ -10,7 +10,7 @@ using MyCompanyName.MyProjectName.Host;
namespace MyCompanyName.MyProjectName.Host.Migrations
{
[DbContext(typeof(DemoAppDbContext))]
[Migration("20181030142530_Initial")]
[Migration("20181212121232_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -42,6 +42,8 @@ namespace MyCompanyName.MyProjectName.Host.Migrations
.HasColumnName("Comments")
.HasMaxLength(256);
b.Property<string>("ConcurrencyStamp");
b.Property<string>("Exceptions")
.HasColumnName("Exceptions")
.HasMaxLength(4000);

5
templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181030142530_Initial.cs → templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181212121232_Initial.cs

@ -12,6 +12,8 @@ namespace MyCompanyName.MyProjectName.Host.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
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),
@ -26,8 +28,7 @@ namespace MyCompanyName.MyProjectName.Host.Migrations
Url = table.Column<string>(maxLength: 256, nullable: true),
Exceptions = table.Column<string>(maxLength: 4000, nullable: true),
Comments = table.Column<string>(maxLength: 256, nullable: true),
HttpStatusCode = table.Column<int>(nullable: true),
ExtraProperties = table.Column<string>(nullable: true)
HttpStatusCode = table.Column<int>(nullable: true)
},
constraints: table =>
{

2
templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/DemoAppDbContextModelSnapshot.cs

@ -40,6 +40,8 @@ namespace MyCompanyName.MyProjectName.Host.Migrations
.HasColumnName("Comments")
.HasMaxLength(256);
b.Property<string>("ConcurrencyStamp");
b.Property<string>("Exceptions")
.HasColumnName("Exceptions")
.HasMaxLength(4000);

Loading…
Cancel
Save