From e1c7ce827d0f23dcc5e36ff19cd4a2f184224e5a Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Thu, 2 Jul 2020 16:43:18 +0800 Subject: [PATCH 01/32] Update the package and pass the build. --- .../Volo.Abp.IdentityServer.Domain.csproj | 4 +- .../IdentityServer/ApiResources/ApiScope.cs | 17 +++--- .../ApiResources/IApiResourceRepository.cs | 6 +- .../ApiResources/IApiScopeeRepository.cs | 16 +++++ .../AbpResourceOwnerPasswordValidator.cs | 10 +--- .../Grants/IPersistentGrantRepository.cs | 21 +++---- .../Grants/PersistedGrantStore.cs | 15 ++--- .../IIdentityResourceRepository.cs | 4 +- .../IdentityServerAutoMapperProfile.cs | 2 +- .../Volo/Abp/IdentityServer/ResourceStore.cs | 60 +++++++++++++------ ...IdentityServerEfCoreQueryableExtensions.cs | 17 +++++- .../ApiResources/ApiResourceRepository.cs | 18 +++--- .../ApiResources/ApiScopeRepository.cs | 29 +++++++++ .../Grants/PersistedGrantRepository.cs | 53 +++++++++------- .../IdentityResourceRepository.cs | 4 +- .../MongoDB/MongoApiResourceRepository.cs | 7 ++- .../MongoIdentityResourceRepository.cs | 2 +- .../MongoDB/MongoPersistedGrantRepository.cs | 41 ++++++++++++- .../Clients/IdentityResourceStore_Tests.cs | 21 +++---- .../Clients/PersistentGrant_Tests.cs | 22 +++++-- .../ApiResourceRepository_Tests.cs | 2 +- .../IdentityResourceRepository_Tests.cs | 2 +- .../PersistentGrantRepository_Tests.cs | 2 +- 23 files changed, 256 insertions(+), 119 deletions(-) create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiScopeeRepository.cs create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj index 0fbb06c694..18a73a1a67 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj @@ -25,8 +25,8 @@ - - + + diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs index c54caea3a9..1d22dec3dc 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs @@ -25,6 +25,8 @@ namespace Volo.Abp.IdentityServer.ApiResources public virtual List UserClaims { get; protected set; } + public virtual Dictionary Properties { get; protected set; } + protected ApiScope() { @@ -36,12 +38,12 @@ namespace Volo.Abp.IdentityServer.ApiResources } protected internal ApiScope( - Guid apiResourceId, - [NotNull] string name, - string displayName = null, - string description = null, - bool required = false, - bool emphasize = false, + Guid apiResourceId, + [NotNull] string name, + string displayName = null, + string description = null, + bool required = false, + bool emphasize = false, bool showInDiscoveryDocument = true) { Check.NotNull(name, nameof(name)); @@ -55,6 +57,7 @@ namespace Volo.Abp.IdentityServer.ApiResources ShowInDiscoveryDocument = showInDiscoveryDocument; UserClaims = new List(); + Properties = new Dictionary(); } public virtual void AddUserClaim([NotNull] string type) @@ -82,4 +85,4 @@ namespace Volo.Abp.IdentityServer.ApiResources return new object[] { ApiResourceId, Name }; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs index 988cd8c4a6..af1dcd6e36 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs @@ -8,8 +8,8 @@ namespace Volo.Abp.IdentityServer.ApiResources { public interface IApiResourceRepository : IBasicRepository { - Task FindByNameAsync( - string name, + Task> FindByNameAsync( + string[] apiResourceNames, bool includeDetails = true, CancellationToken cancellationToken = default ); @@ -40,4 +40,4 @@ namespace Volo.Abp.IdentityServer.ApiResources CancellationToken cancellationToken = default ); } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiScopeeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiScopeeRepository.cs new file mode 100644 index 0000000000..184b8d1b67 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiScopeeRepository.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace Volo.Abp.IdentityServer.ApiResources +{ + public interface IApiScopeRepository : IBasicRepository + { + Task> GetListByNameAsync( + string[] scopeNames, + bool includeDetails = false, + CancellationToken cancellationToken = default + ); + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs index e45df9b3f7..c4169e367f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs @@ -21,7 +21,6 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity public class AbpResourceOwnerPasswordValidator : IResourceOwnerPasswordValidator { protected SignInManager SignInManager { get; } - protected IEventService Events { get; } protected UserManager UserManager { get; } protected ILogger> Logger { get; } protected IStringLocalizer Localizer { get; } @@ -29,13 +28,11 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity public AbpResourceOwnerPasswordValidator( UserManager userManager, SignInManager signInManager, - IEventService events, - ILogger> logger, + ILogger> logger, IStringLocalizer localizer) { UserManager = userManager; SignInManager = signInManager; - Events = events; Logger = logger; Localizer = localizer; } @@ -59,7 +56,6 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity var sub = await UserManager.GetUserIdAsync(user); Logger.LogInformation("Credentials validated for username: {username}", context.UserName); - await Events.RaiseAsync(new UserLoginSuccessEvent(context.UserName, sub, context.UserName, interactive: false)); var additionalClaims = new List(); @@ -76,26 +72,22 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity else if (result.IsLockedOut) { Logger.LogInformation("Authentication failed for username: {username}, reason: locked out", context.UserName); - await Events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "locked out", interactive: false)); errorDescription = Localizer["UserLockedOut"]; } else if (result.IsNotAllowed) { Logger.LogInformation("Authentication failed for username: {username}, reason: not allowed", context.UserName); - await Events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "not allowed", interactive: false)); errorDescription = Localizer["LoginIsNotAllowed"]; } else { Logger.LogInformation("Authentication failed for username: {username}, reason: invalid credentials", context.UserName); - await Events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid credentials", interactive: false)); errorDescription = Localizer["InvalidUserNameOrPassword"]; } } else { Logger.LogInformation("No user found matching username: {username}", context.UserName); - await Events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid username", interactive: false)); errorDescription = Localizer["InvalidUsername"]; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs index 65cfabd7e7..6642440234 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs @@ -8,6 +8,12 @@ namespace Volo.Abp.IdentityServer.Grants { public interface IPersistentGrantRepository : IBasicRepository { + Task> GetListAsync( + string subjectId, + string sessionId, + string clientId, + string type, bool includeDetails = false, CancellationToken cancellationToken = default); + Task FindByKeyAsync( string key, CancellationToken cancellationToken = default @@ -25,16 +31,11 @@ namespace Volo.Abp.IdentityServer.Grants ); Task DeleteAsync( - string subjectId, - string clientId, - CancellationToken cancellationToken = default - ); - - Task DeleteAsync( - string subjectId, - string clientId, - string type, + string subjectId = null, + string sessionId = null, + string clientId = null, + string type = null, CancellationToken cancellationToken = default ); } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs index 091989931b..19efb54a56 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs @@ -44,10 +44,10 @@ namespace Volo.Abp.IdentityServer.Grants return ObjectMapper.Map(persistedGrant); } - public virtual async Task> GetAllAsync(string subjectId) + public virtual async Task> GetAllAsync(PersistedGrantFilter filter) { - var persistedGrants = await PersistentGrantRepository.GetListBySubjectIdAsync(subjectId); - return persistedGrants.Select(x => ObjectMapper.Map(x)); + var persistedGrants = await PersistentGrantRepository.GetListAsync(filter.SubjectId, filter.SessionId, filter.ClientId, filter.Type); + return ObjectMapper.Map, List>(persistedGrants); } public virtual async Task RemoveAsync(string key) @@ -61,14 +61,9 @@ namespace Volo.Abp.IdentityServer.Grants await PersistentGrantRepository.DeleteAsync(persistedGrant); } - public virtual async Task RemoveAllAsync(string subjectId, string clientId) + public virtual async Task RemoveAllAsync(PersistedGrantFilter filter) { - await PersistentGrantRepository.DeleteAsync(subjectId, clientId); - } - - public virtual async Task RemoveAllAsync(string subjectId, string clientId, string type) - { - await PersistentGrantRepository.DeleteAsync(subjectId, clientId, type); + await PersistentGrantRepository.DeleteAsync(filter.SubjectId, filter.SessionId, filter.ClientId, filter.Type); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs index c8b350ce1a..4dd5472ea9 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources { public interface IIdentityResourceRepository : IBasicRepository { - Task> GetListByScopesAsync( + Task> GetListByScopeNameAsync( string[] scopeNames, bool includeDetails = false, CancellationToken cancellationToken = default @@ -35,4 +35,4 @@ namespace Volo.Abp.IdentityServer.IdentityResources CancellationToken cancellationToken = default ); } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs index e576d9413e..502e3fa1e2 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs @@ -37,7 +37,7 @@ namespace Volo.Abp.IdentityServer CreateMap(); - CreateMap(); + CreateMap(); CreateMap>() .ReverseMap(); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs index d01884380d..6252be400c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using IdentityServer4.Models; @@ -6,8 +6,7 @@ using IdentityServer4.Stores; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.ObjectMapping; -using ApiResource = IdentityServer4.Models.ApiResource; -using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; +using ApiScope = Volo.Abp.IdentityServer.ApiResources.ApiScope; namespace Volo.Abp.IdentityServer { @@ -15,45 +14,70 @@ namespace Volo.Abp.IdentityServer { protected IIdentityResourceRepository IdentityResourceRepository { get; } protected IApiResourceRepository ApiResourceRepository { get; } + protected IApiScopeRepository ApiScopeRepository { get; } protected IObjectMapper ObjectMapper { get; } public ResourceStore( - IIdentityResourceRepository identityResourceRepository, - IObjectMapper objectMapper, - IApiResourceRepository apiResourceRepository) + IIdentityResourceRepository identityResourceRepository, + IObjectMapper objectMapper, + IApiResourceRepository apiResourceRepository, + IApiScopeRepository apiScopeRepository) { IdentityResourceRepository = identityResourceRepository; ObjectMapper = objectMapper; ApiResourceRepository = apiResourceRepository; + ApiScopeRepository = apiScopeRepository; } - public virtual async Task> FindIdentityResourcesByScopeAsync(IEnumerable scopeNames) + /// + /// Gets identity resources by scope name. + /// + public virtual async Task> FindIdentityResourcesByScopeNameAsync(IEnumerable scopeNames) { - var resource = await IdentityResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true); - return ObjectMapper.Map, List>(resource); + var resource = await IdentityResourceRepository.GetListByScopeNameAsync(scopeNames.ToArray(), includeDetails: true); + return ObjectMapper.Map, List>(resource); } - public virtual async Task> FindApiResourcesByScopeAsync(IEnumerable scopeNames) + /// + /// Gets API scopes by scope name. + /// + public virtual async Task> FindApiScopesByNameAsync(IEnumerable scopeNames) + { + var scopes = await ApiScopeRepository.GetListByNameAsync(scopeNames.ToArray(), includeDetails: true); + return ObjectMapper.Map, List>(scopes); + } + + /// + /// Gets API resources by scope name. + /// + public virtual async Task> FindApiResourcesByScopeNameAsync(IEnumerable scopeNames) { var resources = await ApiResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true); - return resources.Select(x => ObjectMapper.Map(x)); + return ObjectMapper.Map, List>(resources); } - public virtual async Task FindApiResourceAsync(string name) + /// + /// Gets API resources by API resource name. + /// + public virtual async Task> FindApiResourcesByNameAsync(IEnumerable apiResourceNames) { - var resource = await ApiResourceRepository.FindByNameAsync(name); - return ObjectMapper.Map(resource); + var resources = await ApiResourceRepository.FindByNameAsync(apiResourceNames.ToArray(), includeDetails: true); + return ObjectMapper.Map, List>(resources); } - public virtual async Task GetAllResourcesAsync() + /// + /// Gets all resources. + /// + public virtual async Task GetAllResourcesAsync() { var identityResources = await IdentityResourceRepository.GetListAsync(includeDetails: true); var apiResources = await ApiResourceRepository.GetListAsync(includeDetails: true); + var apiScopes = await ApiScopeRepository.GetListAsync(includeDetails: true); return new Resources( - ObjectMapper.Map, IdentityServer4.Models.IdentityResource[]>(identityResources), - ObjectMapper.Map, ApiResource[]>(apiResources) - ); + ObjectMapper.Map, List>(identityResources), + ObjectMapper.Map, List>(apiResources), + ObjectMapper.Map, List>(apiScopes)); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs index 51b490fc47..a72cadb943 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs @@ -22,6 +22,18 @@ namespace Volo.Abp.IdentityServer .ThenInclude(s => s.UserClaims); } + public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) + { + if (!include) + { + return queryable; + } + + return queryable + .Include(x => x.UserClaims) + .Include(x => x.Properties); + } + public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) { if (!include) @@ -30,7 +42,8 @@ namespace Volo.Abp.IdentityServer } return queryable - .Include(x => x.UserClaims); + .Include(x => x.UserClaims) + .Include(x => x.Properties); } public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) @@ -52,4 +65,4 @@ namespace Volo.Abp.IdentityServer .Include(x => x.Properties); } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index d4fc77ede2..d12a8208c2 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -19,17 +19,14 @@ namespace Volo.Abp.IdentityServer.ApiResources } - public virtual async Task FindByNameAsync( - string name, - bool includeDetails = true, + public async Task> FindByNameAsync(string[] apiResourceNames, bool includeDetails = true, CancellationToken cancellationToken = default) { var query = from apiResource in DbSet.IncludeDetails(includeDetails) - where apiResource.Name == name - select apiResource; + where apiResourceNames.Contains(apiResource.Name) + select apiResource; - return await query - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + return await query.ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListByScopesAsync( @@ -45,7 +42,10 @@ namespace Volo.Abp.IdentityServer.ApiResources } public virtual async Task> GetListAsync( - string sorting, int skipCount, int maxResultCount, string filter, bool includeDetails = false, + string sorting, int skipCount, + int maxResultCount, + string filter, + bool includeDetails = false, CancellationToken cancellationToken = default) { return await DbSet @@ -96,4 +96,4 @@ namespace Volo.Abp.IdentityServer.ApiResources return GetQueryable().IncludeDetails(); } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs new file mode 100644 index 0000000000..dba7405a06 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.IdentityServer.EntityFrameworkCore; + +namespace Volo.Abp.IdentityServer.ApiResources +{ + public class ApiScopeRepository : EfCoreRepository, IApiScopeRepository + { + public ApiScopeRepository(IDbContextProvider dbContextProvider) : base( + dbContextProvider) + { + } + + public async Task> GetListByNameAsync(string[] scopeNames, bool includeDetails = false, + CancellationToken cancellationToken = default) + { + var query = from scope in DbSet.IncludeDetails(includeDetails) + where scopeNames.Contains(scope.Name) + select scope; + + return await query.ToListAsync(GetCancellationToken(cancellationToken)); + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs index 03b752d61b..7a0bf0fbba 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs @@ -12,19 +12,24 @@ namespace Volo.Abp.IdentityServer.Grants { public class PersistentGrantRepository : EfCoreRepository, IPersistentGrantRepository { - public PersistentGrantRepository(IDbContextProvider dbContextProvider) + public PersistentGrantRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } + public async Task> GetListAsync(string subjectId, string sessionId, string clientId, string type, bool includeDetails = false, + CancellationToken cancellationToken = default) + { + return await Filter(subjectId, sessionId, clientId, type) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task FindByKeyAsync( string key, CancellationToken cancellationToken = default) { - return await DbSet - .FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken)) - ; + return await DbSet.FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken)); } public virtual async Task> GetListBySubjectIdAsync( @@ -37,7 +42,7 @@ namespace Volo.Abp.IdentityServer.Grants } public virtual async Task> GetListByExpirationAsync( - DateTime maxExpirationDate, + DateTime maxExpirationDate, int maxResultCount, CancellationToken cancellationToken = default) { @@ -48,27 +53,33 @@ namespace Volo.Abp.IdentityServer.Grants .ToListAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task DeleteAsync( - string subjectId, - string clientId, + public async Task DeleteAsync( + string subjectId = null, + string sessionId = null, + string clientId = null, + string type = null, CancellationToken cancellationToken = default) { - await DeleteAsync( - x => x.SubjectId == subjectId && x.ClientId == clientId, - cancellationToken: GetCancellationToken(cancellationToken) - ); + var persistedGrants = await Filter(subjectId, sessionId, clientId, type).ToListAsync(GetCancellationToken(cancellationToken)); + + foreach (var persistedGrant in persistedGrants) + { + DbSet.Remove(persistedGrant); + } } - public virtual async Task DeleteAsync( - string subjectId, - string clientId, - string type, - CancellationToken cancellationToken = default) + private IQueryable Filter( + string subjectId, + string sessionId, + string clientId, + string type) { - await DeleteAsync( - x => x.SubjectId == subjectId && x.ClientId == clientId && x.Type == type, - cancellationToken: GetCancellationToken(cancellationToken) - ); + //IDS TODO: add SessionId to entity + return DbSet + .WhereIf(!subjectId.IsNullOrWhiteSpace(), x => x.SubjectId == subjectId) + // .WhereIf(!sessionId.IsNullOrWhiteSpace(), x => x.SessionId == sessionId) + .WhereIf(!clientId.IsNullOrWhiteSpace(), x => x.ClientId == clientId) + .WhereIf(!type.IsNullOrWhiteSpace(), x => x.Type == type); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs index faed5fb67a..e86732c1e5 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -19,7 +19,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources } - public virtual async Task> GetListByScopesAsync( + public virtual async Task> GetListByScopeNameAsync( string[] scopeNames, bool includeDetails = false, CancellationToken cancellationToken = default) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index d2c89f193c..de694a37c5 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -18,11 +18,12 @@ namespace Volo.Abp.IdentityServer.MongoDB { } - public virtual async Task FindByNameAsync(string name, bool includeDetails = true, CancellationToken cancellationToken = default) + public async Task> FindByNameAsync(string[] apiResourceNames, bool includeDetails = true, + CancellationToken cancellationToken = default) { return await GetMongoQueryable() - .Where(ar => ar.Name == name) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + .Where(ar => apiResourceNames.Contains(ar.Name)) + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListByScopesAsync(string[] scopeNames, bool includeDetails = false, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs index e166ee9ec5..533136ebb3 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs @@ -40,7 +40,7 @@ namespace Volo.Abp.IdentityServer.MongoDB .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task> GetListByScopesAsync(string[] scopeNames, bool includeDetails = false, + public virtual async Task> GetListByScopeNameAsync(string[] scopeNames, bool includeDetails = false, CancellationToken cancellationToken = default) { return await GetMongoQueryable() diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs index e9b677453b..11559b7707 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs @@ -16,6 +16,13 @@ namespace Volo.Abp.IdentityServer.MongoDB { } + public async Task> GetListAsync(string subjectId, string sessionId, string clientId, string type, bool includeDetails = false, + CancellationToken cancellationToken = default) + { + return await Filter(subjectId, sessionId, clientId, type) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task FindByKeyAsync(string key, CancellationToken cancellationToken = default) { @@ -27,8 +34,7 @@ namespace Volo.Abp.IdentityServer.MongoDB { return await GetMongoQueryable() .Where(x => x.SubjectId == subjectId) - .ToListAsync(GetCancellationToken(cancellationToken)) - ; + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListByExpirationAsync(DateTime maxExpirationDate, int maxResultCount, @@ -41,6 +47,22 @@ namespace Volo.Abp.IdentityServer.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task DeleteAsync( + string subjectId = null, + string sessionId = null, + string clientId = null, + string type = null, + CancellationToken cancellationToken = default) + { + var persistedGrants = await Filter(subjectId, sessionId, clientId, type) + .ToListAsync(GetCancellationToken(cancellationToken)); + + foreach (var persistedGrant in persistedGrants) + { + await DeleteAsync(persistedGrant, false, GetCancellationToken(cancellationToken)); + } + } + public virtual async Task DeleteAsync(string subjectId, string clientId, CancellationToken cancellationToken = default) { await DeleteAsync( @@ -56,5 +78,20 @@ namespace Volo.Abp.IdentityServer.MongoDB cancellationToken: GetCancellationToken(cancellationToken) ); } + + private IMongoQueryable Filter( + string subjectId, + string sessionId, + string clientId, + string type) + { + //IDS TODO: add SessionId to entity + return GetMongoQueryable() + .WhereIf(!subjectId.IsNullOrWhiteSpace(), x => x.SubjectId == subjectId) + // .WhereIf(!sessionId.IsNullOrWhiteSpace(), x => x.SessionId == sessionId) + .WhereIf(!clientId.IsNullOrWhiteSpace(), x => x.ClientId == clientId) + .WhereIf(!type.IsNullOrWhiteSpace(), x => x.Type == type) + .As>(); + } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs index a313c2717f..ef74266285 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindApiResourceAsync_Should_Return_Null_If_Not_Found() { //Act - var resource = await _resourceStore.FindApiResourceAsync("non-existing-name"); + var resource = await _resourceStore.FindApiResourcesByNameAsync(new []{"non-existing-name"}); //Assert resource.ShouldBeNull(); @@ -32,7 +32,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindApiResourceAsync_Should_Return_If_Found() { //Act - var apiResource = await _resourceStore.FindApiResourceAsync("Test-ApiResource-Name-1"); + var apiResource = (await _resourceStore.FindApiResourcesByNameAsync(new []{"Test-ApiResource-Name-1"})).FirstOrDefault(); //Assert apiResource.ShouldNotBe(null); @@ -45,7 +45,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindApiResourcesByScopeAsync_Should_Return_If_Found() { //Act - var apiResources = (await _resourceStore.FindApiResourcesByScopeAsync(new List + var apiResources = (await _resourceStore.FindApiResourcesByScopeNameAsync(new List { "Test-ApiResource-ApiScope-Name-1" })).ToList(); @@ -60,17 +60,18 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindIdentityResourcesByScopeAsync_Should_Return_For_Given_Scopes() { //Act - var identityResourcesByScope = await _resourceStore.FindIdentityResourcesByScopeAsync(new List + var identityResourcesByScope = (await _resourceStore.FindApiResourcesByScopeNameAsync(new List { "Test-Identity-Resource-Name-1" - }); + })).ToArray(); //Assert - var resourcesByScope = identityResourcesByScope as IdentityResource[] ?? identityResourcesByScope.ToArray(); - resourcesByScope.Length.ShouldBe(1); - resourcesByScope.First().DisplayName.ShouldBe("Test-Identity-Resource-DisplayName-1"); - resourcesByScope.First().Description.ShouldBe("Test-Identity-Resource-Description-1"); - resourcesByScope.First().Required.ShouldBe(true); + identityResourcesByScope.Length.ShouldBe(1); + identityResourcesByScope.First().DisplayName.ShouldBe("Test-Identity-Resource-DisplayName-1"); + identityResourcesByScope.First().Description.ShouldBe("Test-Identity-Resource-Description-1"); + + //IDS TODO: + //identityResourcesByScope.First().Required.ShouldBe(true); } [Fact] diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs index 8e83f57c51..c5848ec7de 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs @@ -122,7 +122,10 @@ namespace Volo.Abp.IdentityServer.Clients public async Task GetAllAsync_Should_Get_All_PersistedGrants_For_A_Given_SubjectId() { //Act - var persistentGrants = await _persistedGrantStore.GetAllAsync("TestSubject"); + var persistentGrants = await _persistedGrantStore.GetAllAsync(new PersistedGrantFilter() + { + SubjectId = "TestSubject" + }); //Assert var persistedGrants = persistentGrants as PersistedGrant[] ?? persistentGrants.ToArray(); @@ -156,16 +159,27 @@ namespace Volo.Abp.IdentityServer.Clients public async Task RemoveAllAsync_Should_RemoveAll_PeristedGrants_For_A_Given_Subject_And_ClientId() { //Arrange - var persistedGrantsWithTestSubjectX = await _persistedGrantStore.GetAllAsync("TestSubject-X"); + var persistedGrantsWithTestSubjectX = await _persistedGrantStore.GetAllAsync(new PersistedGrantFilter() + { + SubjectId = "TestSubject-X" + }); var persistedGrantsWithTestSubjectXBeforeLength = persistedGrantsWithTestSubjectX.ToArray().Length; //Act - await _persistedGrantStore.RemoveAllAsync("TestSubject-X", "TestClientId-X"); + await _persistedGrantStore.RemoveAllAsync(new PersistedGrantFilter() + { + SubjectId = "TestSubject-X", + ClientId = "TestClientId-X" + }); //Assert persistedGrantsWithTestSubjectXBeforeLength.ShouldBe(2); - var persistedGrants = (await _persistedGrantStore.GetAllAsync("TestClientId-37")).ToArray(); + var persistedGrants = (await _persistedGrantStore.GetAllAsync(new PersistedGrantFilter() + { + SubjectId = "TestClientId-37" + })).ToArray(); + persistedGrants.ShouldNotBe(null); persistedGrants.Length.ShouldBe(0); } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs index b79114c59a..76fbba2504 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task FindByNormalizedNameAsync() { - (await apiResourceRepository.FindByNameAsync("NewApiResource2")).ShouldNotBeNull(); + (await apiResourceRepository.FindByNameAsync(new []{"NewApiResource2"})).ShouldNotBeNull(); } [Fact] diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs index 3ab47dd7ce..5d41b0afd2 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task GetListByScopesAsync() { - (await identityResourceRepository.GetListByScopesAsync(new[] { "", "NewIdentityResource2" })).Count.ShouldBe(1); + (await identityResourceRepository.GetListByScopeNameAsync(new[] { "", "NewIdentityResource2" })).Count.ShouldBe(1); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs index 20f6674515..91e14bbace 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs @@ -48,7 +48,7 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task DeleteBySubjectIdAndClientIdAndType() { - await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantClientId1", + await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantSessionId1", "PersistedGrantClientId1", "PersistedGrantClientId1"); var persistedGrants = await _persistentGrantRepository.GetListAsync(); From 85b775184cc49551746717aa081a23b5d12fdc83 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Thu, 2 Jul 2020 21:36:48 +0800 Subject: [PATCH 02/32] Update entities & fix unit tests. --- .../ApiResources/ApiScopeConsts.cs | 4 +- .../Devices/DeviceFlowCodesEto.cs | 6 +- .../AllowedSigningAlgorithmsConverter.cs | 37 ++++++++ .../ApiResources/ApiResource.cs | 48 +++++------ .../ApiResources/ApiResourceScope.cs | 38 +++++++++ .../{ApiSecret.cs => ApiResourceSecret.cs} | 20 ++--- .../IdentityServer/ApiResources/ApiScope.cs | 30 +++---- .../ApiResources/ApiScopeClaim.cs | 14 +-- .../ApiResources/ApiScopeProperty.cs | 39 +++++++++ .../Volo/Abp/IdentityServer/Clients/Client.cs | 9 +- .../IdentityServer/Devices/DeviceFlowCodes.cs | 6 +- .../IdentityServer/Grants/PersistedGrant.cs | 12 ++- .../IdentityResources/IdentityResource.cs | 32 +++---- ...ntityClaim.cs => IdentityResourceClaim.cs} | 8 +- .../IdentityResourceProperty.cs | 39 +++++++++ .../IdentityServerAutoMapperProfile.cs | 42 +++++++-- .../Volo/Abp/IdentityServer/ResourceStore.cs | 1 - ...IdentityServerEfCoreQueryableExtensions.cs | 15 +--- .../ApiResources/ApiResourceRepository.cs | 8 +- .../ApiResources/ApiScopeRepository.cs | 4 +- .../IIdentityServerDbContext.cs | 6 +- .../IdentityServerDbContext.cs | 6 +- ...yServerDbContextModelCreatingExtensions.cs | 85 +++++++++++++------ .../Grants/PersistedGrantRepository.cs | 3 +- .../MongoDB/MongoApiResourceRepository.cs | 2 +- .../MongoDB/MongoPersistedGrantRepository.cs | 11 +-- .../Clients/IdentityResourceStore_Tests.cs | 10 +-- .../AbpIdentityServerTestDataBuilder.cs | 7 +- .../AbpIdentityServerTestDataBuilder.cs | 5 +- .../PersistentGrantRepository_Tests.cs | 2 +- 30 files changed, 377 insertions(+), 172 deletions(-) create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedSigningAlgorithmsConverter.cs create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs rename modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/{ApiSecret.cs => ApiResourceSecret.cs} (74%) create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeProperty.cs rename modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/{IdentityClaim.cs => IdentityResourceClaim.cs} (75%) create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceProperty.cs diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs index d52b953921..b61aa097f4 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs @@ -3,7 +3,5 @@ public class ApiScopeConsts { public const int NameMaxLength = 200; - public const int DisplayNameMaxLength = 200; - public const int DescriptionMaxLength = 1000; } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesEto.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesEto.cs index f82af68bbf..66fa1f6eff 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesEto.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesEto.cs @@ -13,10 +13,14 @@ namespace Volo.Abp.IdentityServer.Devices public string SubjectId { get; set; } + public string SessionId { get; set; } + public string ClientId { get; set; } + public string Description { get; set; } + public DateTime? Expiration { get; set; } public string Data { get; set; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedSigningAlgorithmsConverter.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedSigningAlgorithmsConverter.cs new file mode 100644 index 0000000000..ba4809feab --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedSigningAlgorithmsConverter.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using AutoMapper; + +namespace Volo.Abp.IdentityServer +{ + public class AllowedSigningAlgorithmsConverter : + IValueConverter, string>, + IValueConverter> + { + public static AllowedSigningAlgorithmsConverter Converter = new AllowedSigningAlgorithmsConverter(); + + public string Convert(ICollection sourceMember, ResolutionContext context) + { + if (sourceMember == null || !sourceMember.Any()) + { + return null; + } + return sourceMember.Aggregate((x, y) => $"{x},{y}"); + } + + public ICollection Convert(string sourceMember, ResolutionContext context) + { + var list = new HashSet(); + if (!String.IsNullOrWhiteSpace(sourceMember)) + { + sourceMember = sourceMember.Trim(); + foreach (var item in sourceMember.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Distinct()) + { + list.Add(item); + } + } + return list; + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs index d2b1a630d4..dc795fb09b 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using IdentityServer4; @@ -18,9 +18,13 @@ namespace Volo.Abp.IdentityServer.ApiResources public virtual bool Enabled { get; set; } - public virtual List Secrets { get; protected set; } + public virtual string AllowedAccessTokenSigningAlgorithms { get; set; } - public virtual List Scopes { get; protected set; } + public virtual bool ShowInDiscoveryDocument { get; set; } = true; + + public virtual List Secrets { get; protected set; } + + public virtual List Scopes { get; protected set; } public virtual List UserClaims { get; protected set; } @@ -44,21 +48,21 @@ namespace Volo.Abp.IdentityServer.ApiResources Enabled = true; - Secrets = new List(); - Scopes = new List(); + Secrets = new List(); + Scopes = new List(); UserClaims = new List(); Properties = new Dictionary(); - Scopes.Add(new ApiScope(id, name, displayName, description)); + Scopes.Add(new ApiResourceScope(id, name)); } public virtual void AddSecret( - [NotNull] string value, + [NotNull] string value, DateTime? expiration = null, string type = IdentityServerConstants.SecretTypes.SharedSecret, string description = null) { - Secrets.Add(new ApiSecret(Id, value, expiration, type, description)); + Secrets.Add(new ApiResourceSecret(Id, value, expiration, type, description)); } public virtual void RemoveSecret([NotNull] string value, string type = IdentityServerConstants.SecretTypes.SharedSecret) @@ -66,22 +70,16 @@ namespace Volo.Abp.IdentityServer.ApiResources Secrets.RemoveAll(s => s.Value == value && s.Type == type); } - public virtual ApiSecret FindSecret([NotNull] string value, string type = IdentityServerConstants.SecretTypes.SharedSecret) + public virtual ApiResourceSecret FindSecret([NotNull] string value, string type = IdentityServerConstants.SecretTypes.SharedSecret) { return Secrets.FirstOrDefault(s => s.Type == type && s.Value == value); } - public virtual ApiScope AddScope( - [NotNull] string name, - string displayName = null, - string description = null, - bool required = false, - bool emphasize = false, - bool showInDiscoveryDocument = true) + public virtual ApiResourceScope AddScope([NotNull] string scope) { - var scope = new ApiScope(Id, name, displayName, description, required, emphasize, showInDiscoveryDocument); - Scopes.Add(scope); - return scope; + var apiResourceScope = new ApiResourceScope(Id, scope); + Scopes.Add(apiResourceScope); + return apiResourceScope; } public virtual void AddUserClaim([NotNull] string type) @@ -111,21 +109,17 @@ namespace Volo.Abp.IdentityServer.ApiResources public virtual void RemoveAllScopes() { - foreach (var scope in Scopes) - { - scope.RemoveAllUserClaims(); - } Scopes.Clear(); } - public virtual void RemoveScope(string name) + public virtual void RemoveScope(string scope) { - Scopes.RemoveAll(r => r.Name == name); + Scopes.RemoveAll(r => r.Scope == scope); } - public virtual ApiScope FindScope(string name) + public virtual ApiResourceScope FindScope(string scope) { - return Scopes.FirstOrDefault(r => r.Name == name); + return Scopes.FirstOrDefault(r => r.Scope == scope); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs new file mode 100644 index 0000000000..4da2beaa3f --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs @@ -0,0 +1,38 @@ +using System; +using JetBrains.Annotations; +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.IdentityServer.ApiResources +{ + public class ApiResourceScope : Entity + { + public virtual Guid ApiResourceId { get; protected set; } + + public virtual string Scope { get; set; } + + protected ApiResourceScope() + { + + } + + public virtual bool Equals(Guid apiResourceId, [NotNull] string scope) + { + return ApiResourceId == apiResourceId && Scope == scope; + } + + protected internal ApiResourceScope( + Guid apiResourceId, + [NotNull] string scope) + { + Check.NotNull(scope, nameof(scope)); + + ApiResourceId = apiResourceId; + Scope = scope; + } + + public override object[] GetKeys() + { + return new object[] { ApiResourceId, Scope }; + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecret.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs similarity index 74% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecret.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs index e692183a71..dcc6b04768 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecret.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs @@ -4,11 +4,11 @@ using JetBrains.Annotations; namespace Volo.Abp.IdentityServer.ApiResources { - public class ApiSecret : Secret + public class ApiResourceSecret : Secret { public virtual Guid ApiResourceId { get; protected set; } - protected ApiSecret() + protected ApiResourceSecret() { } @@ -18,16 +18,16 @@ namespace Volo.Abp.IdentityServer.ApiResources return ApiResourceId == apiResourceId && Value == value && Type == type; } - protected internal ApiSecret( + protected internal ApiResourceSecret( Guid apiResourceId, - [NotNull] string value, - DateTime? expiration = null, - string type = IdentityServerConstants.SecretTypes.SharedSecret, + [NotNull] string value, + DateTime? expiration = null, + string type = IdentityServerConstants.SecretTypes.SharedSecret, string description = null ) : base( - value, - expiration, - type, + value, + expiration, + type, description) { ApiResourceId = apiResourceId; @@ -38,4 +38,4 @@ namespace Volo.Abp.IdentityServer.ApiResources return new object[] { ApiResourceId, Type, Value }; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs index 1d22dec3dc..8e8605afa1 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs @@ -1,14 +1,14 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; -using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Entities.Auditing; namespace Volo.Abp.IdentityServer.ApiResources { - public class ApiScope : Entity + public class ApiScope : FullAuditedAggregateRoot { - public virtual Guid ApiResourceId { get; protected set; } + public virtual bool Enabled { get; set; } [NotNull] public virtual string Name { get; protected set; } @@ -25,44 +25,39 @@ namespace Volo.Abp.IdentityServer.ApiResources public virtual List UserClaims { get; protected set; } - public virtual Dictionary Properties { get; protected set; } + public virtual List Properties { get; protected set; } protected ApiScope() { } - public virtual bool Equals(Guid apiResourceId, [NotNull] string name) - { - return ApiResourceId == apiResourceId && Name == name; - } - protected internal ApiScope( - Guid apiResourceId, [NotNull] string name, string displayName = null, string description = null, bool required = false, bool emphasize = false, - bool showInDiscoveryDocument = true) + bool showInDiscoveryDocument = true, + bool enabled = true) { Check.NotNull(name, nameof(name)); - ApiResourceId = apiResourceId; Name = name; DisplayName = displayName ?? name; Description = description; Required = required; Emphasize = emphasize; ShowInDiscoveryDocument = showInDiscoveryDocument; + Enabled = enabled; UserClaims = new List(); - Properties = new Dictionary(); + Properties = new List(); } public virtual void AddUserClaim([NotNull] string type) { - UserClaims.Add(new ApiScopeClaim(ApiResourceId, Name, type)); + UserClaims.Add(new ApiScopeClaim(Id, Name, type)); } public virtual void RemoveAllUserClaims() @@ -79,10 +74,5 @@ namespace Volo.Abp.IdentityServer.ApiResources { return UserClaims.FirstOrDefault(r => r.Name == Name && r.Type == type); } - - public override object[] GetKeys() - { - return new object[] { ApiResourceId, Name }; - } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs index 729ff9c344..e4444cbc8c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.IdentityServer.ApiResources { public class ApiScopeClaim : UserClaim { - public Guid ApiResourceId { get; protected set; } + public Guid ApiScopeId { get; protected set; } [NotNull] public string Name { get; protected set; } @@ -15,23 +15,23 @@ namespace Volo.Abp.IdentityServer.ApiResources } - public virtual bool Equals(Guid apiResourceId, [NotNull] string name, [NotNull] string type) + public virtual bool Equals(Guid apiScopeId, [NotNull] string name, [NotNull] string type) { - return ApiResourceId == apiResourceId && Name == name && Type == type; + return ApiScopeId == apiScopeId && Name == name && Type == type; } - protected internal ApiScopeClaim(Guid apiResourceId, [NotNull] string name, [NotNull] string type) + protected internal ApiScopeClaim(Guid apiScopeId, [NotNull] string name, [NotNull] string type) : base(type) { Check.NotNull(name, nameof(name)); - ApiResourceId = apiResourceId; + ApiScopeId = apiScopeId; Name = name; } public override object[] GetKeys() { - return new object[] { ApiResourceId, Name, Type }; + return new object[] { ApiScopeId, Name, Type }; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeProperty.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeProperty.cs new file mode 100644 index 0000000000..38f34567a8 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeProperty.cs @@ -0,0 +1,39 @@ +using System; +using JetBrains.Annotations; +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.IdentityServer.ApiResources +{ + public class ApiScopeProperty : Entity + { + public virtual Guid ApiScopeId { get; set; } + + public virtual string Key { get; set; } + + public virtual string Value { get; set; } + + protected ApiScopeProperty() + { + + } + + public virtual bool Equals(Guid apiScopeId, [NotNull] string key, string value) + { + return ApiScopeId == apiScopeId && Key == key && Value == value; + } + + protected internal ApiScopeProperty(Guid apiScopeId, [NotNull] string key, [NotNull] string value) + { + Check.NotNull(key, nameof(key)); + + ApiScopeId = apiScopeId; + Key = key; + Value = value; + } + + public override object[] GetKeys() + { + return new object[] { ApiScopeId, Key }; + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs index b7a53ad66f..82ba75a5fb 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs @@ -36,6 +36,8 @@ namespace Volo.Abp.IdentityServer.Clients public virtual bool AllowPlainTextPkce { get; set; } + public virtual bool RequireRequestObject { get; set; } + public virtual bool AllowAccessTokensViaBrowser { get; set; } public virtual string FrontChannelLogoutUri { get; set; } @@ -50,6 +52,8 @@ namespace Volo.Abp.IdentityServer.Clients public virtual int IdentityTokenLifetime { get; set; } + public virtual string AllowedIdentityTokenSigningAlgorithms { get; set; } + public virtual int AccessTokenLifetime { get; set; } public virtual int AuthorizationCodeLifetime { get; set; } @@ -118,8 +122,9 @@ namespace Volo.Abp.IdentityServer.Clients ProtocolType = IdentityServerConstants.ProtocolTypes.OpenIdConnect; RequireClientSecret = true; - RequireConsent = true; + RequireConsent = false; AllowRememberConsent = true; + RequirePkce = true; FrontChannelLogoutSessionRequired = true; BackChannelLogoutSessionRequired = true; IdentityTokenLifetime = 300; @@ -319,4 +324,4 @@ namespace Volo.Abp.IdentityServer.Clients return IdentityProviderRestrictions.FirstOrDefault(r => r.Provider == provider); } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowCodes.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowCodes.cs index 3961de57a2..c24452a08b 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowCodes.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowCodes.cs @@ -11,8 +11,12 @@ namespace Volo.Abp.IdentityServer.Devices public virtual string SubjectId { get; set; } + public virtual string SessionId { get; set; } + public virtual string ClientId { get; set; } + public virtual string Description { get; set; } + public virtual DateTime? Expiration { get; set; } public virtual string Data { get; set; } @@ -28,4 +32,4 @@ namespace Volo.Abp.IdentityServer.Devices } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrant.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrant.cs index 4a2bccd456..1865ec748b 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrant.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrant.cs @@ -1,4 +1,4 @@ -using System; +using System; using Volo.Abp.Domain.Entities; namespace Volo.Abp.IdentityServer.Grants @@ -11,17 +11,23 @@ namespace Volo.Abp.IdentityServer.Grants public virtual string SubjectId { get; set; } + public virtual string SessionId { get; set; } + public virtual string ClientId { get; set; } + public virtual string Description { get; set; } + public virtual DateTime CreationTime { get; set; } public virtual DateTime? Expiration { get; set; } + public virtual DateTime? ConsumedTime { get; set; } + public virtual string Data { get; set; } protected PersistedGrant() { - + } public PersistedGrant(Guid id) @@ -29,4 +35,4 @@ namespace Volo.Abp.IdentityServer.Grants Id = id; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs index f5d6f6c39c..246e1ddf98 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs @@ -22,9 +22,9 @@ namespace Volo.Abp.IdentityServer.IdentityResources public virtual bool ShowInDiscoveryDocument { get; set; } - public virtual List UserClaims { get; set; } + public virtual List UserClaims { get; set; } - public virtual Dictionary Properties { get; set; } + public virtual List Properties { get; set; } protected IdentityResource() { @@ -32,13 +32,13 @@ namespace Volo.Abp.IdentityServer.IdentityResources } public IdentityResource( - Guid id, - [NotNull] string name, - string displayName = null, - string description = null, - bool enabled = true, - bool required = false, - bool emphasize = false, + Guid id, + [NotNull] string name, + string displayName = null, + string description = null, + bool enabled = true, + bool required = false, + bool emphasize = false, bool showInDiscoveryDocument = true) { Check.NotNull(name, nameof(name)); @@ -51,9 +51,9 @@ namespace Volo.Abp.IdentityServer.IdentityResources Required = required; Emphasize = emphasize; ShowInDiscoveryDocument = showInDiscoveryDocument; - - UserClaims = new List(); - Properties = new Dictionary(); + + UserClaims = new List(); + Properties = new List(); } public IdentityResource(Guid id, IdentityServer4.Models.IdentityResource resource) @@ -66,13 +66,13 @@ namespace Volo.Abp.IdentityServer.IdentityResources Required = resource.Required; Emphasize = resource.Emphasize; ShowInDiscoveryDocument = resource.ShowInDiscoveryDocument; - UserClaims = resource.UserClaims.Select(claimType => new IdentityClaim(id, claimType)).ToList(); - Properties = resource.Properties.ToDictionary(x => x.Key, x => x.Value); + UserClaims = resource.UserClaims.Select(claimType => new IdentityResourceClaim(id, claimType)).ToList(); + Properties = resource.Properties.Select(x => new IdentityResourceProperty(Id, x.Key, x.Value)).ToList(); } public virtual void AddUserClaim([NotNull] string type) { - UserClaims.Add(new IdentityClaim(Id, type)); + UserClaims.Add(new IdentityResourceClaim(Id, type)); } public virtual void RemoveAllUserClaims() @@ -85,7 +85,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources UserClaims.RemoveAll(c => c.Type == type); } - public virtual IdentityClaim FindUserClaim(string type) + public virtual IdentityResourceClaim FindUserClaim(string type) { return UserClaims.FirstOrDefault(c => c.Type == type); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceClaim.cs similarity index 75% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityClaim.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceClaim.cs index 8b4a22b584..2bce3f66cf 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityClaim.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceClaim.cs @@ -3,11 +3,11 @@ using JetBrains.Annotations; namespace Volo.Abp.IdentityServer.IdentityResources { - public class IdentityClaim : UserClaim + public class IdentityResourceClaim : UserClaim { public virtual Guid IdentityResourceId { get; set; } - protected IdentityClaim() + protected IdentityResourceClaim() { } @@ -17,7 +17,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources return IdentityResourceId == identityResourceId && Type == type; } - protected internal IdentityClaim(Guid identityResourceId, [NotNull] string type) + protected internal IdentityResourceClaim(Guid identityResourceId, [NotNull] string type) : base(type) { IdentityResourceId = identityResourceId; @@ -28,4 +28,4 @@ namespace Volo.Abp.IdentityServer.IdentityResources return new object[] { IdentityResourceId, Type }; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceProperty.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceProperty.cs new file mode 100644 index 0000000000..d351addfc2 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceProperty.cs @@ -0,0 +1,39 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.IdentityServer.IdentityResources +{ + public class IdentityResourceProperty : Entity + { + public virtual Guid IdentityResourceId { get; set; } + + public virtual string Key { get; set; } + + public virtual string Value { get; set; } + + protected IdentityResourceProperty() + { + + } + + public virtual bool Equals(Guid identityResourceId, [NotNull] string key) + { + return IdentityResourceId == identityResourceId && Key == key; + } + + protected internal IdentityResourceProperty(Guid identityResourceId, [NotNull] string key, [NotNull] string value) + { + Check.NotNull(key, nameof(key)); + + IdentityResourceId = identityResourceId; + Key = key; + Value = value; + } + + public override object[] GetKeys() + { + return new object[] { IdentityResourceId, Key }; + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs index 502e3fa1e2..17aae1b084 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs @@ -15,8 +15,6 @@ namespace Volo.Abp.IdentityServer { //TODO: Reverse maps will not used probably. Remove those will not used - CreateMap(); - CreateMap() .ConstructUsing(src => src.Origin) .ReverseMap() @@ -25,26 +23,53 @@ namespace Volo.Abp.IdentityServer CreateMap() .ForMember(dest => dest.ApiSecrets, opt => opt.MapFrom(src => src.Secrets)); + CreateMap(); + + //TODO: Why PersistedGrant mapping is in this profile? CreateMap().ReverseMap(); - CreateMap(); + CreateMap() + .ConstructUsing(src => new IdentityServer4.Models.IdentityResource()); + + CreateMap() + .ConstructUsing(x => x.Type) + .ReverseMap() + .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src)); + + CreateMap>() + .ReverseMap(); CreateMap() .ConstructUsing(src => src.Type) .ReverseMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src)); - CreateMap(); + CreateMap() + .ConstructUsing(x => x.Scope) + .ReverseMap() + .ForMember(dest => dest.Scope, opt => opt.MapFrom(src => src)); - CreateMap(); + CreateMap>() + .ReverseMap(); + + CreateMap() + .ConstructUsing(x => x.Type) + .ReverseMap() + .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src)); + + CreateMap(MemberList.Destination) + .ConstructUsing(src => new IdentityServer4.Models.ApiScope()) + .ReverseMap(); CreateMap>() .ReverseMap(); CreateMap() .ForMember(dest => dest.ProtocolType, opt => opt.Condition(srs => srs != null)) - .ReverseMap(); + .ForMember(x => x.AllowedIdentityTokenSigningAlgorithms, opts => opts.ConvertUsing(AllowedSigningAlgorithmsConverter.Converter, x => x.AllowedIdentityTokenSigningAlgorithms)) + .ReverseMap() + .ForMember(x => x.AllowedIdentityTokenSigningAlgorithms, opts => opts.ConvertUsing(AllowedSigningAlgorithmsConverter.Converter, x => x.AllowedIdentityTokenSigningAlgorithms)); CreateMap() .ConstructUsing(src => src.Origin) @@ -60,6 +85,10 @@ namespace Volo.Abp.IdentityServer .ConstructUsing(src => new Claim(src.Type, src.Value)) .ReverseMap(); + CreateMap(MemberList.None) + .ConstructUsing(src => new IdentityServer4.Models.ClientClaim(src.Type, src.Value, ClaimValueTypes.String)) + .ReverseMap(); + CreateMap() .ConstructUsing(src => src.Scope) .ReverseMap() @@ -89,6 +118,7 @@ namespace Volo.Abp.IdentityServer CreateMap(); CreateMap(); CreateMap(); + } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs index 6252be400c..975fc7f801 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs @@ -6,7 +6,6 @@ using IdentityServer4.Stores; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.ObjectMapping; -using ApiScope = Volo.Abp.IdentityServer.ApiResources.ApiScope; namespace Volo.Abp.IdentityServer { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs index a72cadb943..6e47d461e4 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs @@ -18,20 +18,7 @@ namespace Volo.Abp.IdentityServer return queryable .Include(x => x.Secrets) .Include(x => x.UserClaims) - .Include(x => x.Scopes) - .ThenInclude(s => s.UserClaims); - } - - public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) - { - if (!include) - { - return queryable; - } - - return queryable - .Include(x => x.UserClaims) - .Include(x => x.Properties); + .Include(x => x.Scopes); } public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index d12a8208c2..4d0baf7702 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.IdentityServer.ApiResources CancellationToken cancellationToken = default) { var query = from api in DbSet.IncludeDetails(includeDetails) - where api.Scopes.Any(x => scopeNames.Contains(x.Name)) + where api.Scopes.Any(x => scopeNames.Contains(x.Scope)) select api; return await query.ToListAsync(GetCancellationToken(cancellationToken)); @@ -74,18 +74,18 @@ namespace Volo.Abp.IdentityServer.ApiResources public override async Task DeleteAsync(Guid id, bool autoSave = false, CancellationToken cancellationToken = default) { - var scopeClaims = DbContext.Set().Where(sc => sc.ApiResourceId == id); + var scopeClaims = DbContext.Set().Where(sc => sc.ApiScopeId == id); foreach (var scopeClaim in scopeClaims) { DbContext.Set().Remove(scopeClaim); } - var scopes = DbContext.Set().Where(s => s.ApiResourceId == id); + var scopes = DbContext.Set().Where(s => s.ApiResourceId == id); foreach (var scope in scopes) { - DbContext.Set().Remove(scope); + DbContext.Set().Remove(scope); } await base.DeleteAsync(id, autoSave, cancellationToken); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs index dba7405a06..6df9f5b90a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs @@ -19,9 +19,7 @@ namespace Volo.Abp.IdentityServer.ApiResources public async Task> GetListByNameAsync(string[] scopeNames, bool includeDetails = false, CancellationToken cancellationToken = default) { - var query = from scope in DbSet.IncludeDetails(includeDetails) - where scopeNames.Contains(scope.Name) - select scope; + var query = from scope in DbSet where scopeNames.Contains(scope.Name) select scope; return await query.ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs index 52ba7c8e6c..93624174f9 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs @@ -14,17 +14,17 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore { DbSet ApiResources { get; set; } - DbSet ApiSecrets { get; set; } + DbSet ApiSecrets { get; set; } DbSet ApiResourceClaims { get; set; } - DbSet ApiScopes { get; set; } + DbSet ApiScopes { get; set; } DbSet ApiScopeClaims { get; set; } DbSet IdentityResources { get; set; } - DbSet IdentityClaims { get; set; } + DbSet IdentityClaims { get; set; } DbSet Clients { get; set; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs index f63cd6bf1c..84ec1f802a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs @@ -14,17 +14,17 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore { public DbSet ApiResources { get; set; } - public DbSet ApiSecrets { get; set; } + public DbSet ApiSecrets { get; set; } public DbSet ApiResourceClaims { get; set; } - public DbSet ApiScopes { get; set; } + public DbSet ApiScopes { get; set; } public DbSet ApiScopeClaims { get; set; } public DbSet IdentityResources { get; set; } - public DbSet IdentityClaims { get; set; } + public DbSet IdentityClaims { get; set; } public DbSet Clients { get; set; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index 8acb8a9539..54b91e9dcc 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -81,8 +81,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql)) { ClientRedirectUriConsts.RedirectUriMaxLengthValue = 300; - } - + } + b.Property(x => x.RedirectUri).HasMaxLength(ClientRedirectUriConsts.RedirectUriMaxLengthValue).IsRequired(); }); @@ -97,8 +97,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql)) { ClientPostLogoutRedirectUriConsts.PostLogoutRedirectUriMaxLengthValue = 300; - } - + } + b.Property(x => x.PostLogoutRedirectUri) .HasMaxLength(ClientPostLogoutRedirectUriConsts.PostLogoutRedirectUriMaxLengthValue) .IsRequired(); @@ -129,7 +129,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore { SecretConsts.ValueMaxLengthValue = 300; } - + b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLengthValue).IsRequired(); b.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); @@ -195,9 +195,9 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql)) { - PersistedGrantConsts.DataMaxLengthValue = 10000; //TODO: MySQL accepts 20.000. We can consider to change in v3.0. + PersistedGrantConsts.DataMaxLengthValue = 10000; //TODO: MySQL accepts 20.000. We can consider to change in v3.0. } - + b.Property(x => x.Data).HasMaxLength(PersistedGrantConsts.DataMaxLengthValue).IsRequired(); b.HasKey(x => x.Key); //TODO: What about Id!!! @@ -215,16 +215,14 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.Name).HasMaxLength(IdentityResourceConsts.NameMaxLength).IsRequired(); b.Property(x => x.DisplayName).HasMaxLength(IdentityResourceConsts.DisplayNameMaxLength); b.Property(x => x.Description).HasMaxLength(IdentityResourceConsts.DescriptionMaxLength); - b.Property(x => x.Properties) - .HasConversion(new AbpJsonValueConverter>()) - .Metadata.SetValueComparer(new AbpDictionaryValueComparer()); b.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.IdentityResourceId).IsRequired(); + b.HasMany(x => x.Properties).WithOne().HasForeignKey(x => x.IdentityResourceId).IsRequired(); }); - builder.Entity(b => + builder.Entity(b => { - b.ToTable(options.TablePrefix + "IdentityClaims", options.Schema); + b.ToTable(options.TablePrefix + "IdentityResourceClaims", options.Schema); b.ConfigureByConvention(); @@ -233,6 +231,18 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.Type).HasMaxLength(UserClaimConsts.TypeMaxLength).IsRequired(); }); + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "IdentityResourceProperties", options.Schema); + + b.ConfigureByConvention(); + + b.HasKey(x => new {x.IdentityResourceId, x.Key}); + + b.Property(x => x.Key).HasMaxLength(250).IsRequired(); + b.Property(x => x.Value).HasMaxLength(2000).IsRequired(); + }); + builder.Entity(b => { b.ToTable(options.TablePrefix + "ApiResources", options.Schema); @@ -251,9 +261,9 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); }); - builder.Entity(b => + builder.Entity(b => { - b.ToTable(options.TablePrefix + "ApiSecrets", options.Schema); + b.ToTable(options.TablePrefix + "ApiResourceSecrets", options.Schema); b.ConfigureByConvention(); @@ -265,14 +275,14 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { SecretConsts.ValueMaxLengthValue = 300; - } - + } + b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLengthValue).IsRequired(); }); builder.Entity(b => { - b.ToTable(options.TablePrefix + "ApiClaims", options.Schema); + b.ToTable(options.TablePrefix + "ApiResourceClaims", options.Schema); b.ConfigureByConvention(); @@ -281,19 +291,33 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.Type).HasMaxLength(UserClaimConsts.TypeMaxLength).IsRequired(); }); + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "ApiResourceScopes", options.Schema); + + b.ConfigureByConvention(); + + b.HasKey(x => new {x.ApiResourceId, x.Scope}); + + b.Property(x => x.Scope).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired(); + }); + builder.Entity(b => { b.ToTable(options.TablePrefix + "ApiScopes", options.Schema); b.ConfigureByConvention(); - b.HasKey(x => new {x.ApiResourceId, x.Name}); + b.Property(x => x.Name).HasMaxLength(200).IsRequired(); + b.Property(x => x.DisplayName).HasMaxLength(200); + b.Property(x => x.Description).HasMaxLength(1000); - b.Property(x => x.Name).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired(); - b.Property(x => x.DisplayName).HasMaxLength(ApiScopeConsts.DisplayNameMaxLength); - b.Property(x => x.Description).HasMaxLength(ApiScopeConsts.DescriptionMaxLength); + b.HasIndex(x => x.Name).IsUnique(); - b.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => new {x.ApiResourceId, x.Name}).IsRequired(); + b.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.ApiScopeId).IsRequired(); + + //Identity Server does not configure the relationship of Properties + //b.HasMany(x => x.Properties).WithOne().HasForeignKey(x => x.ApiScopeId).IsRequired(); }); builder.Entity(b => @@ -302,12 +326,25 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.ConfigureByConvention(); - b.HasKey(x => new {x.ApiResourceId, x.Name, x.Type}); + b.HasKey(x => new {x.ApiScopeId, x.Name, x.Type}); b.Property(x => x.Type).HasMaxLength(UserClaimConsts.TypeMaxLength).IsRequired(); b.Property(x => x.Name).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired(); }); + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "ApiScopeProperties", options.Schema); + + b.ConfigureByConvention(); + + b.HasKey(x => new {x.ApiScopeId, x.Key}); + + b.Property(x => x.Key).HasMaxLength(250).IsRequired(); + //oracle? + b.Property(x => x.Value).HasMaxLength(2000).IsRequired(); + }); + builder.Entity(b => { b.ToTable(options.TablePrefix + "DeviceFlowCodes", options.Schema); @@ -344,4 +381,4 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore return false; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs index 7a0bf0fbba..9b54a4cf24 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs @@ -74,10 +74,9 @@ namespace Volo.Abp.IdentityServer.Grants string clientId, string type) { - //IDS TODO: add SessionId to entity return DbSet .WhereIf(!subjectId.IsNullOrWhiteSpace(), x => x.SubjectId == subjectId) - // .WhereIf(!sessionId.IsNullOrWhiteSpace(), x => x.SessionId == sessionId) + .WhereIf(!sessionId.IsNullOrWhiteSpace(), x => x.SessionId == sessionId) .WhereIf(!clientId.IsNullOrWhiteSpace(), x => x.ClientId == clientId) .WhereIf(!type.IsNullOrWhiteSpace(), x => x.Type == type); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index de694a37c5..20d55b3d0e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.IdentityServer.MongoDB CancellationToken cancellationToken = default) { return await GetMongoQueryable() - .Where(ar => ar.Scopes.Any(x => scopeNames.Contains(x.Name))) + .Where(ar => ar.Scopes.Any(x => scopeNames.Contains(x.Scope))) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs index 11559b7707..6af1f5488d 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; @@ -8,6 +9,7 @@ using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.MongoDB; + namespace Volo.Abp.IdentityServer.MongoDB { public class MongoPersistentGrantRepository : MongoDbRepository, IPersistentGrantRepository @@ -85,12 +87,11 @@ namespace Volo.Abp.IdentityServer.MongoDB string clientId, string type) { - //IDS TODO: add SessionId to entity return GetMongoQueryable() - .WhereIf(!subjectId.IsNullOrWhiteSpace(), x => x.SubjectId == subjectId) - // .WhereIf(!sessionId.IsNullOrWhiteSpace(), x => x.SessionId == sessionId) - .WhereIf(!clientId.IsNullOrWhiteSpace(), x => x.ClientId == clientId) - .WhereIf(!type.IsNullOrWhiteSpace(), x => x.Type == type) + .WhereIf>(!subjectId.IsNullOrWhiteSpace(), x => x.SubjectId == subjectId) + .WhereIf>(!sessionId.IsNullOrWhiteSpace(), x => x.SessionId == sessionId) + .WhereIf>(!clientId.IsNullOrWhiteSpace(), x => x.ClientId == clientId) + .WhereIf>(!type.IsNullOrWhiteSpace(), x => x.Type == type) .As>(); } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs index ef74266285..a196fd7534 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs @@ -19,13 +19,13 @@ namespace Volo.Abp.IdentityServer.Clients } [Fact] - public async Task FindApiResourceAsync_Should_Return_Null_If_Not_Found() + public async Task FindApiResourceAsync_Should_Return_Empty_If_Not_Found() { //Act var resource = await _resourceStore.FindApiResourcesByNameAsync(new []{"non-existing-name"}); //Assert - resource.ShouldBeNull(); + resource.ShouldBeEmpty(); } [Fact] @@ -60,7 +60,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindIdentityResourcesByScopeAsync_Should_Return_For_Given_Scopes() { //Act - var identityResourcesByScope = (await _resourceStore.FindApiResourcesByScopeNameAsync(new List + var identityResourcesByScope = (await _resourceStore.FindIdentityResourcesByScopeNameAsync(new List { "Test-Identity-Resource-Name-1" })).ToArray(); @@ -69,9 +69,7 @@ namespace Volo.Abp.IdentityServer.Clients identityResourcesByScope.Length.ShouldBe(1); identityResourcesByScope.First().DisplayName.ShouldBe("Test-Identity-Resource-DisplayName-1"); identityResourcesByScope.First().Description.ShouldBe("Test-Identity-Resource-Description-1"); - - //IDS TODO: - //identityResourcesByScope.First().Required.ShouldBe(true); + identityResourcesByScope.First().Required.ShouldBe(true); } [Fact] diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index 0d87a2fd19..d2efa7b352 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.IdentityServer IClientRepository clientRepository, IGuidGenerator guidGenerator, IPersistentGrantRepository persistentGrantRepository, - IApiResourceRepository apiResourceRepository, + IApiResourceRepository apiResourceRepository, IIdentityResourceRepository identityResourceRepository) { _clientRepository = clientRepository; @@ -51,7 +51,7 @@ namespace Volo.Abp.IdentityServer { ProtocolType = "TestProtocol-42" }; - + client42.AddCorsOrigin("Origin1"); client42.AddScope("api1"); @@ -108,7 +108,8 @@ namespace Volo.Abp.IdentityServer }; apiResource.AddSecret("secret".Sha256()); - apiResource.AddScope("Test-ApiResource-ApiScope-Name-1", "Test-ApiResource-ApiScope-DisplayName-1"); + apiResource.AddScope("Test-ApiResource-ApiScope-Name-1"); + apiResource.AddScope("Test-ApiResource-ApiScope-DisplayName-1"); apiResource.AddUserClaim("Test-ApiResource-Claim-Type-1"); await _apiResourceRepository.InsertAsync(apiResource); diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index c36fef2d58..21e7123abe 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -91,6 +91,7 @@ namespace Volo.Abp.IdentityServer { Key = "PersistedGrantKey1", SubjectId = "PersistedGrantSubjectId1", + SessionId = "PersistedGrantSessionId1", ClientId = "PersistedGrantClientId1", Type = "PersistedGrantType1", Data = "" @@ -147,9 +148,9 @@ namespace Volo.Abp.IdentityServer apiResource.Description = nameof(apiResource.Description); apiResource.DisplayName = nameof(apiResource.DisplayName); - apiResource.AddScope(nameof(ApiScope.Name)); + apiResource.AddScope(nameof(ApiResourceScope.Scope)); apiResource.AddUserClaim(nameof(ApiResourceClaim.Type)); - apiResource.AddSecret(nameof(ApiSecret.Value)); + apiResource.AddSecret(nameof(ApiResourceSecret.Value)); await _apiResourceRepository.InsertAsync(apiResource); await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource2")); diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs index 91e14bbace..73e2537207 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs @@ -36,7 +36,7 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task DeleteBySubjectIdAndClientId() { - await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantClientId1"); + await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantSessionId1", "PersistedGrantClientId1"); var persistedGrants = await _persistentGrantRepository.GetListAsync(); persistedGrants.ShouldNotBeEmpty(); From b839f679325735120c329dffb230a0e17e6fc59d Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Fri, 3 Jul 2020 11:36:36 +0800 Subject: [PATCH 03/32] Refactored the consensus page. --- .../ConsentOptions.cs | 17 ++ .../IdentityServerSupportedLoginModel.cs | 9 +- .../Pages/Consent.cshtml | 72 +++-- .../Pages/Consent.cshtml.cs | 252 +++++++++++------- .../Clients/IdentityResourceStore_Tests.cs | 2 +- 5 files changed, 219 insertions(+), 133 deletions(-) create mode 100644 modules/account/src/Volo.Abp.Account.Web.IdentityServer/ConsentOptions.cs diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/ConsentOptions.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/ConsentOptions.cs new file mode 100644 index 0000000000..3aaafd5d11 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/ConsentOptions.cs @@ -0,0 +1,17 @@ +namespace Volo.Abp.Account.Web +{ + public class ConsentOptions + { + public static bool EnableOfflineAccess = true; + + public static string OfflineAccessDisplayName = "Offline Access"; + + public static string OfflineAccessDescription = "Access to your applications and resources, even when you are offline"; + + //TODO: How to handle this + public static readonly string MustChooseOneErrorMessage = "You must pick at least one permission"; + + //TODO: How to handle this + public static readonly string InvalidSelectionErrorMessage = "Invalid selection"; + } +} diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs index 60f55497da..c09c9751c2 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs @@ -73,9 +73,9 @@ namespace Volo.Abp.Account.Web.Pages.Account EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); - if (context?.ClientId != null) + if (context?.Client?.ClientId != null) { - var client = await ClientStore.FindEnabledClientByIdAsync(context.ClientId); + var client = await ClientStore.FindEnabledClientByIdAsync(context?.Client?.ClientId); if (client != null) { EnableLocalLogin = client.EnableLocalLogin; @@ -105,7 +105,10 @@ namespace Volo.Abp.Account.Web.Pages.Account return Redirect("~/"); } - await Interaction.GrantConsentAsync(context, ConsentResponse.Denied); + await Interaction.GrantConsentAsync(context, new ConsentResponse() + { + Error = AuthorizationError.AccessDenied + }); return Redirect(ReturnUrl); } diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml index b61ad00152..d92e72532e 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml @@ -1,18 +1,18 @@ @page +@using IdentityServer4.Extensions @using Volo.Abp.Account.Web.Pages -@using Volo.Abp.Account.Web.Pages.Account @model ConsentModel

- @if (Model.ClientInfo.ClientLogoUrl != null) + @if (Model.Consent.ClientLogoUrl != null) { - + } - @Model.ClientInfo.ClientName + @Model.Consent.ClientName is requesting your permission

@@ -25,29 +25,30 @@
Uncheck the permissions you do not wish to grant.
- @if (!Model.ConsentInput.IdentityScopes.IsNullOrEmpty()) + @if (!Model.Consent.IdentityScopes.IsNullOrEmpty()) {

Personal Information

    - @for (var i = 0; i < Model.ConsentInput.IdentityScopes.Count; i++) + + @foreach (var identityScope in Model.Consent.IdentityScopes) {
  • -
    - @* TODO: Use attributes on the view model instead of using hidden here *@ - @if (Model.ConsentInput.IdentityScopes[i].Description != null) + @* TODO: Use attributes on the view model instead of using hidden here *@ + @if (identityScope.Description != null) { }
  • @@ -55,29 +56,30 @@
} - @if (!Model.ConsentInput.ApiScopes.IsNullOrEmpty()) + @if (!Model.Consent.ApiScopes.IsNullOrEmpty()) {

Application Access

    - @for (var i = 0; i < Model.ConsentInput.ApiScopes.Count; i++) + + @foreach (var apiScope in Model.Consent.ApiScopes) {
  • -
    - @* TODO: Use attributes on the view model instead of using hidden here *@ - @if (Model.ConsentInput.ApiScopes[i].Description != null) + @* TODO: Use attributes on the view model instead of using hidden here *@ + @if (apiScope.Description != null) { }
  • @@ -85,11 +87,23 @@
} - @if (Model.ClientInfo.AllowRememberConsent) +
+
+
+ + Description +
+
+ +
+
+
+ + @if (Model.Consent.AllowRememberConsent) {
-
@@ -98,10 +112,10 @@
- @if (Model.ClientInfo.ClientUrl != null) + @if (Model.Consent.ClientUrl != null) { - - @Model.ClientInfo.ClientName + + @Model.Consent.ClientName }
@@ -110,4 +124,4 @@ - \ No newline at end of file + diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs index a0f0543765..64173917e3 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs @@ -3,12 +3,13 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; +using IdentityServer4.Extensions; using IdentityServer4.Models; using IdentityServer4.Services; using IdentityServer4.Stores; +using IdentityServer4.Validation; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; -using Volo.Abp.UI; namespace Volo.Abp.Account.Web.Pages { @@ -24,9 +25,7 @@ namespace Volo.Abp.Account.Web.Pages public string ReturnUrlHash { get; set; } [BindProperty] - public ConsentModel.ConsentInputModel ConsentInput { get; set; } - - public ClientInfoModel ClientInfo { get; set; } + public ConsentViewModel Consent { get; set; } private readonly IIdentityServerInteractionService _interaction; private readonly IClientStore _clientStore; @@ -44,37 +43,7 @@ namespace Volo.Abp.Account.Web.Pages public virtual async Task OnGet() { - var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); - if (request == null) - { - throw new ApplicationException($"No consent request matching request: {ReturnUrl}"); - } - - var client = await _clientStore.FindEnabledClientByIdAsync(request.ClientId); - if (client == null) - { - throw new ApplicationException($"Invalid client id: {request.ClientId}"); - } - - var resources = await _resourceStore.FindEnabledResourcesByScopeAsync(request.ScopesRequested); - if (resources == null || (!resources.IdentityResources.Any() && !resources.ApiResources.Any())) - { - throw new ApplicationException($"No scopes matching: {request.ScopesRequested.Aggregate((x, y) => x + ", " + y)}"); - } - - ClientInfo = new ClientInfoModel(client); - ConsentInput = new ConsentInputModel - { - RememberConsent = true, - IdentityScopes = resources.IdentityResources.Select(x => CreateScopeViewModel(x, true)).ToList(), - ApiScopes = resources.ApiResources.SelectMany(x => x.Scopes).Select(x => CreateScopeViewModel(x, true)).ToList() - }; - - if (resources.OfflineAccess) - { - ConsentInput.ApiScopes.Add(GetOfflineAccessScope(true)); - } - + Consent = await BuildViewModelAsync(ReturnUrl); return Page(); } @@ -96,53 +65,137 @@ namespace Volo.Abp.Account.Web.Pages throw new ApplicationException("Unknown Error!"); } - protected virtual async Task ProcessConsentAsync() + protected virtual async Task ProcessConsentAsync() { - var result = new ConsentModel.ProcessConsentResult(); + var result = new ProcessConsentResult(); + + // validate return url is still valid + var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); + if (request == null) + { + return result; + } - ConsentResponse grantedConsent; + ConsentResponse grantedConsent = null; - if (ConsentInput.UserDecision == "no") + // user clicked 'no' - send back the standard 'access_denied' response + if (Consent?.Button == "no") { - grantedConsent = ConsentResponse.Denied; + grantedConsent = new ConsentResponse { Error = AuthorizationError.AccessDenied }; + // emit event + //await _events.RaiseAsync(new ConsentDeniedEvent(User.GetSubjectId(), request.Client.ClientId, request.ValidatedResources.RawScopeValues)); } - else + // user clicked 'yes' - validate the data + else if (Consent?.Button == "yes") { - if (!ConsentInput.IdentityScopes.IsNullOrEmpty() || !ConsentInput.ApiScopes.IsNullOrEmpty()) + // if the user consented to some scope, build the response model + if (!Consent.ScopesConsented.IsNullOrEmpty()) { + var scopes = Consent.ScopesConsented; + if (ConsentOptions.EnableOfflineAccess == false) + { + scopes = scopes.Where(x => x != IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess); + } + grantedConsent = new ConsentResponse { - RememberConsent = ConsentInput.RememberConsent, - ScopesConsented = ConsentInput.GetAllowedScopeNames() + RememberConsent = Consent.RememberConsent, + ScopesValuesConsented = scopes.ToArray(), + Description = Consent.Description }; + + // emit event + //await _events.RaiseAsync(new ConsentGrantedEvent(User.GetSubjectId(), request.Client.ClientId, request.ValidatedResources.RawScopeValues, grantedConsent.ScopesValuesConsented, grantedConsent.RememberConsent)); } else { - throw new UserFriendlyException("You must pick at least one permission"); //TODO: How to handle this + //throw new UserFriendlyException("You must pick at least one permission"); //TODO: How to handle this + result.ValidationError = ConsentOptions.MustChooseOneErrorMessage; } } + else + { + result.ValidationError = ConsentOptions.InvalidSelectionErrorMessage; + } if (grantedConsent != null) { - var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); - if (request == null) - { - return result; - } - + // communicate outcome of consent back to identityserver await _interaction.GrantConsentAsync(request, grantedConsent); - result.RedirectUri = ReturnUrl; //TODO: ReturnUrlHash? + // indicate that's it ok to redirect back to authorization endpoint + result.RedirectUri = Consent.ReturnUrl; //TODO: ReturnUrlHash? + result.Client = request.Client; + } + else + { + // we need to redisplay the consent UI + + result.ViewModel = await BuildViewModelAsync(ReturnUrl, Consent); } return result; } - protected virtual ConsentModel.ScopeViewModel CreateScopeViewModel(IdentityResource identity, bool check) + private async Task BuildViewModelAsync(string returnUrl, ConsentInputModel model = null) + { + var request = await _interaction.GetAuthorizationContextAsync(returnUrl); + if (request != null) + { + return CreateConsentViewModel(model, returnUrl, request); + } + + throw new ApplicationException($"No consent request matching request: {returnUrl}"); + } + + private ConsentViewModel CreateConsentViewModel(ConsentInputModel model, string returnUrl, AuthorizationRequest request) + { + var consentViewModel = new ConsentViewModel + { + RememberConsent = model?.RememberConsent ?? true, + ScopesConsented = model?.ScopesConsented ?? Enumerable.Empty(), + Description = model?.Description, + + ReturnUrl = returnUrl, + + ClientName = request.Client.ClientName ?? request.Client.ClientId, + ClientUrl = request.Client.ClientUri, + ClientLogoUrl = request.Client.LogoUri, + AllowRememberConsent = request.Client.AllowRememberConsent + }; + + consentViewModel.IdentityScopes = request.ValidatedResources.Resources.IdentityResources.Select(x => + CreateScopeViewModel(x, consentViewModel.ScopesConsented.Contains(x.Name) || model == null)) + .ToArray(); + + var apiScopes = new List(); + foreach(var parsedScope in request.ValidatedResources.ParsedScopes) + { + var apiScope = request.ValidatedResources.Resources.FindApiScope(parsedScope.ParsedName); + if (apiScope != null) + { + var scopeVm = CreateScopeViewModel(parsedScope, apiScope, + consentViewModel.ScopesConsented.Contains(parsedScope.RawValue) || model == null); + apiScopes.Add(scopeVm); + } + } + + if (ConsentOptions.EnableOfflineAccess && request.ValidatedResources.Resources.OfflineAccess) + { + apiScopes.Add(GetOfflineAccessScope(consentViewModel.ScopesConsented.Contains(IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); + } + + consentViewModel.ApiScopes = apiScopes; + + return consentViewModel; + } + + + protected virtual ScopeViewModel CreateScopeViewModel(IdentityResource identity, bool check) { - return new ConsentModel.ScopeViewModel + return new ScopeViewModel { - Name = identity.Name, + Value = identity.Name, DisplayName = identity.DisplayName, Description = identity.Description, Emphasize = identity.Emphasize, @@ -151,24 +204,30 @@ namespace Volo.Abp.Account.Web.Pages }; } - protected virtual ConsentModel.ScopeViewModel CreateScopeViewModel(Scope scope, bool check) + protected virtual ScopeViewModel CreateScopeViewModel(ParsedScopeValue parsedScopeValue, ApiScope apiScope, bool check) { - return new ConsentModel.ScopeViewModel - { - Name = scope.Name, - DisplayName = scope.DisplayName, - Description = scope.Description, - Emphasize = scope.Emphasize, - Required = scope.Required, - Checked = check || scope.Required + var displayName = apiScope.DisplayName ?? apiScope.Name; + if (!string.IsNullOrWhiteSpace(parsedScopeValue.ParsedParameter)) + { + displayName += ":" + parsedScopeValue.ParsedParameter; + } + + return new ScopeViewModel + { + Value = parsedScopeValue.RawValue, + DisplayName = displayName, + Description = apiScope.Description, + Emphasize = apiScope.Emphasize, + Required = apiScope.Required, + Checked = check || apiScope.Required }; } - protected virtual ConsentModel.ScopeViewModel GetOfflineAccessScope(bool check) + protected virtual ScopeViewModel GetOfflineAccessScope(bool check) { - return new ConsentModel.ScopeViewModel + return new ScopeViewModel { - Name = IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess, + Value = IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess, DisplayName = "Offline Access", //TODO: Localize Description = "Access to your applications and resources, even when you are offline", Emphasize = true, @@ -178,28 +237,37 @@ namespace Volo.Abp.Account.Web.Pages public class ConsentInputModel { - public List IdentityScopes { get; set; } - - public List ApiScopes { get; set; } - [Required] - public string UserDecision { get; set; } + public string Button { get; set; } + public IEnumerable ScopesConsented { get; set; } public bool RememberConsent { get; set; } - public List GetAllowedScopeNames() - { - var identityScopes = IdentityScopes ?? new List(); - var apiScopes = ApiScopes ?? new List(); - return identityScopes.Union(apiScopes).Where(s => s.Checked).Select(s => s.Name).ToList(); - } + public string ReturnUrl { get; set; } + + public string Description { get; set; } + } + + + public class ConsentViewModel : ConsentInputModel + { + public string ClientName { get; set; } + public string ClientUrl { get; set; } + + public string ClientLogoUrl { get; set; } + + public bool AllowRememberConsent { get; set; } + + public IEnumerable IdentityScopes { get; set; } + + public IEnumerable ApiScopes { get; set; } } public class ScopeViewModel { [Required] [HiddenInput] - public string Name { get; set; } + public string Value { get; set; } public bool Checked { get; set; } @@ -216,29 +284,13 @@ namespace Volo.Abp.Account.Web.Pages { public bool IsRedirect => RedirectUri != null; public string RedirectUri { get; set; } + public Client Client { get; set; } + + public bool ShowView => ViewModel != null; + public ConsentViewModel ViewModel { get; set; } public bool HasValidationError => ValidationError != null; public string ValidationError { get; set; } } - - public class ClientInfoModel - { - public string ClientName { get; set; } - - public string ClientUrl { get; set; } - - public string ClientLogoUrl { get; set; } - - public bool AllowRememberConsent { get; set; } - - public ClientInfoModel(Client client) - { - //TODO: Automap - ClientName = client.ClientId; - ClientUrl = client.ClientUri; - ClientLogoUrl = client.LogoUri; - AllowRememberConsent = client.AllowRememberConsent; - } - } } -} \ No newline at end of file +} diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs index a196fd7534..fcbb937bc4 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs @@ -53,7 +53,7 @@ namespace Volo.Abp.IdentityServer.Clients //Assert apiResources.ShouldNotBe(null); - apiResources[0].Scopes.Count.ShouldBe(2); + apiResources[0].Scopes.Count.ShouldBe(3); } [Fact] From 6f6d238bb5ff1d10b6ab1d8556d2ff5d2141cb62 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Fri, 3 Jul 2020 12:00:16 +0800 Subject: [PATCH 04/32] Add FindByNameAsync to IApiResourceRepository. --- .../ApiResources/IApiResourceRepository.cs | 6 ++++++ .../IdentityServer/ApiResources/ApiResourceRepository.cs | 9 +++++++++ .../IdentityServer/MongoDB/MongoApiResourceRepository.cs | 7 +++++++ 3 files changed, 22 insertions(+) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs index af1dcd6e36..8b9057d129 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs @@ -8,6 +8,12 @@ namespace Volo.Abp.IdentityServer.ApiResources { public interface IApiResourceRepository : IBasicRepository { + Task FindByNameAsync( + string apiResourceName, + bool includeDetails = true, + CancellationToken cancellationToken = default + ); + Task> FindByNameAsync( string[] apiResourceNames, bool includeDetails = true, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index 4d0baf7702..1949238a3b 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -19,6 +19,15 @@ namespace Volo.Abp.IdentityServer.ApiResources } + public async Task FindByNameAsync(string apiResourceName, bool includeDetails = true, CancellationToken cancellationToken = default) + { + var query = from apiResource in DbSet.IncludeDetails(includeDetails) + where apiResource.Name == apiResourceName + select apiResource; + + return await query.FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + public async Task> FindByNameAsync(string[] apiResourceNames, bool includeDetails = true, CancellationToken cancellationToken = default) { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index 20d55b3d0e..44375fce93 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -18,6 +18,13 @@ namespace Volo.Abp.IdentityServer.MongoDB { } + public async Task FindByNameAsync(string apiResourceName, bool includeDetails = true, CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .Where(ar => ar.Name == apiResourceName) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + public async Task> FindByNameAsync(string[] apiResourceNames, bool includeDetails = true, CancellationToken cancellationToken = default) { From a40b35a089532e6d47ff1340ad13cf20b81bfa9e Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Fri, 3 Jul 2020 17:18:32 +0800 Subject: [PATCH 05/32] Use constants in EF entity configuration. --- .../ApiResources/ApiResourceScopeConsts.cs | 7 ++ .../ApiResourceSecretConsts.cs} | 12 +-- .../ApiResources/ApiScopeConsts.cs | 7 -- .../ApiScopes/ApiResourceConsts.cs | 9 ++ .../ApiScopes/ApiScopeClaimConsts.cs | 7 ++ .../ApiScopes/ApiScopePropertyConsts.cs | 9 ++ .../Devices/DeviceFlowCodesConsts.cs | 12 +++ .../IdentityResourcePropertyConsts.cs | 9 ++ .../{ApiResources => ApiScopes}/ApiScope.cs | 2 +- .../ApiScopeClaim.cs | 2 +- .../ApiScopeProperty.cs | 2 +- .../IApiScopeeRepository.cs | 2 +- .../IdentityServerAutoMapperProfile.cs | 1 + .../Volo/Abp/IdentityServer/ResourceStore.cs | 5 +- .../ApiResources/ApiResourceRepository.cs | 12 ++- .../ApiResources/ApiScopeRepository.cs | 1 + .../IIdentityServerDbContext.cs | 28 +++++- .../IdentityServerDbContext.cs | 28 +++++- ...yServerDbContextModelCreatingExtensions.cs | 90 +++++++++++++------ .../AbpIdentityServerMongoDbContext.cs | 3 + 20 files changed, 193 insertions(+), 55 deletions(-) create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceScopeConsts.cs rename modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/{SecretConsts.cs => ApiResources/ApiResourceSecretConsts.cs} (84%) delete mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiResourceConsts.cs create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaimConsts.cs create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiScopePropertyConsts.cs create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesConsts.cs create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourcePropertyConsts.cs rename modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/{ApiResources => ApiScopes}/ApiScope.cs (97%) rename modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/{ApiResources => ApiScopes}/ApiScopeClaim.cs (94%) rename modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/{ApiResources => ApiScopes}/ApiScopeProperty.cs (95%) rename modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/{ApiResources => ApiScopes}/IApiScopeeRepository.cs (89%) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceScopeConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceScopeConsts.cs new file mode 100644 index 0000000000..8b0d8f4769 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceScopeConsts.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.IdentityServer.ApiResources +{ + public class ApiResourceScopeConsts + { + public const int ScopeMaxLength = 200; + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs similarity index 84% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs index 156088a97b..261f48ac2e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs @@ -1,22 +1,22 @@ -namespace Volo.Abp.IdentityServer +namespace Volo.Abp.IdentityServer.ApiResources { - public class SecretConsts + public class ApiResourceSecretConsts { /// /// Default value: 250 /// public static int TypeMaxLength { get; set; } = 250; - + /// /// Default value: 4000 /// public static int ValueMaxLength { get; set; } = 4000; - + public static int ValueMaxLengthValue { get; set; } = ValueMaxLength; - + /// /// Default value: 2000 /// public static int DescriptionMaxLength { get; set; } = 2000; } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs deleted file mode 100644 index b61aa097f4..0000000000 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Volo.Abp.IdentityServer.ApiResources -{ - public class ApiScopeConsts - { - public const int NameMaxLength = 200; - } -} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiResourceConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiResourceConsts.cs new file mode 100644 index 0000000000..ab268690be --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiResourceConsts.cs @@ -0,0 +1,9 @@ +namespace Volo.Abp.IdentityServer.ApiScopes +{ + public class ApiScopeConsts + { + public const int NameMaxLength = 200; + public const int DisplayNameMaxLength = 200; + public const int DescriptionMaxLength = 1000; + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaimConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaimConsts.cs new file mode 100644 index 0000000000..f3175e8774 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaimConsts.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.IdentityServer.ApiScopes +{ + public class ApiScopeClaimConsts + { + public const int NameMaxLength = 200; + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiScopePropertyConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiScopePropertyConsts.cs new file mode 100644 index 0000000000..5450e67030 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiScopes/ApiScopePropertyConsts.cs @@ -0,0 +1,9 @@ +namespace Volo.Abp.IdentityServer.ApiScopes +{ + public class ApiScopePropertyConsts + { + public const int KeyMaxLength = 250; + public const int ValueMaxLength = 2000; + public static int ValueMaxLengthValue { get; set; } = ValueMaxLength; + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesConsts.cs new file mode 100644 index 0000000000..b0c87fe89d --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesConsts.cs @@ -0,0 +1,12 @@ +namespace Volo.Abp.IdentityServer.Devices +{ + public class DeviceFlowCodesConsts + { + public const int DeviceCodeMaxLength = 200; + public const int UserCodeMaxLength = 200; + public const int SubjectIdMaxLength = 200; + public const int ClientIdMaxLength = 200; + public const int DataMaxLength = 50000; + public static int DataMaxLengthValue { get; set; } = DataMaxLength; + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourcePropertyConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourcePropertyConsts.cs new file mode 100644 index 0000000000..2c9ccbb0c4 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourcePropertyConsts.cs @@ -0,0 +1,9 @@ +namespace Volo.Abp.IdentityServer.IdentityResources +{ + public class IdentityResourcePropertyConsts + { + public const int KeyMaxLength = 250; + public const int ValueMaxLength = 2000; + public static int ValueMaxLengthValue { get; set; } = ValueMaxLength; + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs similarity index 97% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs index 8e8605afa1..d35294c27f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs @@ -4,7 +4,7 @@ using System.Linq; using JetBrains.Annotations; using Volo.Abp.Domain.Entities.Auditing; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiScope : FullAuditedAggregateRoot { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaim.cs similarity index 94% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaim.cs index e4444cbc8c..0bb6704a22 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaim.cs @@ -1,7 +1,7 @@ using System; using JetBrains.Annotations; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiScopeClaim : UserClaim { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeProperty.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScopeProperty.cs similarity index 95% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeProperty.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScopeProperty.cs index 38f34567a8..b6e5d7fbe8 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeProperty.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScopeProperty.cs @@ -2,7 +2,7 @@ using JetBrains.Annotations; using Volo.Abp.Domain.Entities; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiScopeProperty : Entity { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiScopeeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeeRepository.cs similarity index 89% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiScopeeRepository.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeeRepository.cs index 184b8d1b67..1cbc48499e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiScopeeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeeRepository.cs @@ -3,7 +3,7 @@ using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public interface IApiScopeRepository : IBasicRepository { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs index 17aae1b084..99d24e617d 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs @@ -2,6 +2,7 @@ using System.Security.Claims; using AutoMapper; using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs index 975fc7f801..5afaaf4400 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using IdentityServer4.Models; using IdentityServer4.Stores; using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.ObjectMapping; @@ -43,7 +44,7 @@ namespace Volo.Abp.IdentityServer public virtual async Task> FindApiScopesByNameAsync(IEnumerable scopeNames) { var scopes = await ApiScopeRepository.GetListByNameAsync(scopeNames.ToArray(), includeDetails: true); - return ObjectMapper.Map, List>(scopes); + return ObjectMapper.Map, List>(scopes); } /// @@ -76,7 +77,7 @@ namespace Volo.Abp.IdentityServer return new Resources( ObjectMapper.Map, List>(identityResources), ObjectMapper.Map, List>(apiResources), - ObjectMapper.Map, List>(apiScopes)); + ObjectMapper.Map, List>(apiScopes)); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index 1949238a3b..74ea53d9e0 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -83,16 +83,14 @@ namespace Volo.Abp.IdentityServer.ApiResources public override async Task DeleteAsync(Guid id, bool autoSave = false, CancellationToken cancellationToken = default) { - var scopeClaims = DbContext.Set().Where(sc => sc.ApiScopeId == id); - - foreach (var scopeClaim in scopeClaims) + var resourceClaims = DbContext.Set().Where(sc => sc.ApiResourceId == id); + foreach (var scopeClaim in resourceClaims) { - DbContext.Set().Remove(scopeClaim); + DbContext.Set().Remove(scopeClaim); } - var scopes = DbContext.Set().Where(s => s.ApiResourceId == id); - - foreach (var scope in scopes) + var resourceScopes = DbContext.Set().Where(s => s.ApiResourceId == id); + foreach (var scope in resourceScopes) { DbContext.Set().Remove(scope); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs index 6df9f5b90a..87f67ec330 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.EntityFrameworkCore; namespace Volo.Abp.IdentityServer.ApiResources diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs index 93624174f9..7834db31fb 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs @@ -2,6 +2,7 @@ using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; @@ -12,20 +13,41 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore [ConnectionStringName(AbpIdentityServerDbProperties.ConnectionStringName)] public interface IIdentityServerDbContext : IEfCoreDbContext { + #region ApiResource + DbSet ApiResources { get; set; } - DbSet ApiSecrets { get; set; } + DbSet ApiResourceSecrets { get; set; } DbSet ApiResourceClaims { get; set; } - DbSet ApiScopes { get; set; } + DbSet ApiResourceScopes { get; set; } + + #endregion + + #region ApiScope + + DbSet ApiScopes { get; set; } DbSet ApiScopeClaims { get; set; } + DbSet ApiScopeProperties { get; set; } + + #endregion + + + #region IdentityResource + DbSet IdentityResources { get; set; } DbSet IdentityClaims { get; set; } + DbSet IdentityResourceProperties { get; set; } + + #endregion + + #region Client + DbSet Clients { get; set; } DbSet ClientGrantTypes { get; set; } @@ -46,6 +68,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore DbSet ClientProperties { get; set; } + #endregion + DbSet PersistedGrants { get; set; } DbSet DeviceFlowCodes { get; set; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs index 84ec1f802a..686d2e0ac1 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs @@ -2,6 +2,7 @@ using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; @@ -12,20 +13,41 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore [ConnectionStringName(AbpIdentityServerDbProperties.ConnectionStringName)] public class IdentityServerDbContext : AbpDbContext, IIdentityServerDbContext { + #region ApiResource + public DbSet ApiResources { get; set; } - public DbSet ApiSecrets { get; set; } + public DbSet ApiResourceSecrets { get; set; } public DbSet ApiResourceClaims { get; set; } - public DbSet ApiScopes { get; set; } + public DbSet ApiResourceScopes { get; set; } + + #endregion + + #region ApiScope + + public DbSet ApiScopes { get; set; } public DbSet ApiScopeClaims { get; set; } + public DbSet ApiScopeProperties { get; set; } + + #endregion + + + #region IdentityResource + public DbSet IdentityResources { get; set; } public DbSet IdentityClaims { get; set; } + public DbSet IdentityResourceProperties { get; set; } + + #endregion + + #region Client + public DbSet Clients { get; set; } public DbSet ClientGrantTypes { get; set; } @@ -46,6 +68,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore public DbSet ClientProperties { get; set; } + #endregion + public DbSet PersistedGrants { get; set; } public DbSet DeviceFlowCodes { get; set; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index 54b91e9dcc..26b8036aba 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -6,10 +6,16 @@ using Volo.Abp.EntityFrameworkCore.Modeling; using Volo.Abp.EntityFrameworkCore.ValueComparers; using Volo.Abp.EntityFrameworkCore.ValueConverters; using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; +using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; +using Client = Volo.Abp.IdentityServer.Clients.Client; +using ClientClaim = Volo.Abp.IdentityServer.Clients.ClientClaim; +using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; +using PersistedGrant = Volo.Abp.IdentityServer.Grants.PersistedGrant; namespace Volo.Abp.IdentityServer.EntityFrameworkCore { @@ -28,6 +34,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore optionsAction?.Invoke(options); + #region Client + builder.Entity(b => { b.ToTable(options.TablePrefix + "Clients", options.Schema); @@ -123,16 +131,16 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.ClientId, x.Type, x.Value}); - b.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired(); + b.Property(x => x.Type).HasMaxLength(ApiResourceSecretConsts.TypeMaxLength).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { - SecretConsts.ValueMaxLengthValue = 300; + ApiResourceSecretConsts.ValueMaxLengthValue = 300; } - b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLengthValue).IsRequired(); + b.Property(x => x.Value).HasMaxLength(ApiResourceSecretConsts.ValueMaxLengthValue).IsRequired(); - b.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); + b.Property(x => x.Description).HasMaxLength(ApiResourceSecretConsts.DescriptionMaxLength); }); builder.Entity(b => @@ -206,6 +214,10 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasIndex(x => x.Expiration); }); + #endregion + + #region IdentityResource + builder.Entity(b => { b.ToTable(options.TablePrefix + "IdentityResources", options.Schema); @@ -216,6 +228,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.DisplayName).HasMaxLength(IdentityResourceConsts.DisplayNameMaxLength); b.Property(x => x.Description).HasMaxLength(IdentityResourceConsts.DescriptionMaxLength); + b.HasIndex(x => x.Name).IsUnique(); + b.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.IdentityResourceId).IsRequired(); b.HasMany(x => x.Properties).WithOne().HasForeignKey(x => x.IdentityResourceId).IsRequired(); }); @@ -239,11 +253,19 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.IdentityResourceId, x.Key}); - b.Property(x => x.Key).HasMaxLength(250).IsRequired(); - b.Property(x => x.Value).HasMaxLength(2000).IsRequired(); + b.Property(x => x.Key).HasMaxLength(IdentityResourcePropertyConsts.KeyMaxLength).IsRequired(); + if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) + { + IdentityResourcePropertyConsts.ValueMaxLengthValue = 300; + } + b.Property(x => x.Value).HasMaxLength(IdentityResourcePropertyConsts.ValueMaxLengthValue).IsRequired(); }); - builder.Entity(b => + #endregion + + #region ApiResource + + builder.Entity(b => { b.ToTable(options.TablePrefix + "ApiResources", options.Schema); @@ -269,15 +291,15 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.ApiResourceId, x.Type, x.Value}); - b.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired(); - b.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); + b.Property(x => x.Type).HasMaxLength(ApiResourceSecretConsts.TypeMaxLength).IsRequired(); + b.Property(x => x.Description).HasMaxLength(ApiResourceSecretConsts.DescriptionMaxLength); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { - SecretConsts.ValueMaxLengthValue = 300; + ApiResourceSecretConsts.ValueMaxLengthValue = 300; } - b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLengthValue).IsRequired(); + b.Property(x => x.Value).HasMaxLength(ApiResourceSecretConsts.ValueMaxLengthValue).IsRequired(); }); builder.Entity(b => @@ -299,24 +321,28 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.ApiResourceId, x.Scope}); - b.Property(x => x.Scope).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired(); + b.Property(x => x.Scope).HasMaxLength(ApiResourceScopeConsts.ScopeMaxLength).IsRequired(); }); + #endregion + + #region ApiScope + builder.Entity(b => { b.ToTable(options.TablePrefix + "ApiScopes", options.Schema); b.ConfigureByConvention(); - b.Property(x => x.Name).HasMaxLength(200).IsRequired(); - b.Property(x => x.DisplayName).HasMaxLength(200); - b.Property(x => x.Description).HasMaxLength(1000); + b.Property(x => x.Name).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired(); + b.Property(x => x.DisplayName).HasMaxLength(ApiScopeConsts.DisplayNameMaxLength); + b.Property(x => x.Description).HasMaxLength(ApiScopeConsts.DescriptionMaxLength); b.HasIndex(x => x.Name).IsUnique(); b.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.ApiScopeId).IsRequired(); - //Identity Server does not configure the relationship of Properties + //TODO: Identity Server does not configure the relationship of Properties //b.HasMany(x => x.Properties).WithOne().HasForeignKey(x => x.ApiScopeId).IsRequired(); }); @@ -329,7 +355,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.ApiScopeId, x.Name, x.Type}); b.Property(x => x.Type).HasMaxLength(UserClaimConsts.TypeMaxLength).IsRequired(); - b.Property(x => x.Name).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired(); + b.Property(x => x.Name).HasMaxLength(ApiScopeClaimConsts.NameMaxLength).IsRequired(); }); builder.Entity(b => @@ -340,28 +366,42 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.ApiScopeId, x.Key}); - b.Property(x => x.Key).HasMaxLength(250).IsRequired(); - //oracle? - b.Property(x => x.Value).HasMaxLength(2000).IsRequired(); + b.Property(x => x.Key).HasMaxLength(ApiScopePropertyConsts.KeyMaxLength).IsRequired(); + if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) + { + ApiScopePropertyConsts.ValueMaxLengthValue = 300; + } + b.Property(x => x.Value).HasMaxLength(ApiScopePropertyConsts.ValueMaxLengthValue).IsRequired(); }); + #endregion + + #region DeviceFlowCodes + builder.Entity(b => { b.ToTable(options.TablePrefix + "DeviceFlowCodes", options.Schema); b.ConfigureByConvention(); - b.Property(x => x.DeviceCode).HasMaxLength(200).IsRequired(); - b.Property(x => x.UserCode).HasMaxLength(200).IsRequired(); - b.Property(x => x.SubjectId).HasMaxLength(200); - b.Property(x => x.ClientId).HasMaxLength(200).IsRequired(); + b.Property(x => x.DeviceCode).HasMaxLength(DeviceFlowCodesConsts.DeviceCodeMaxLength).IsRequired(); + b.Property(x => x.UserCode).HasMaxLength(DeviceFlowCodesConsts.UserCodeMaxLength).IsRequired(); + b.Property(x => x.SubjectId).HasMaxLength(DeviceFlowCodesConsts.SubjectIdMaxLength); + b.Property(x => x.ClientId).HasMaxLength(DeviceFlowCodesConsts.ClientIdMaxLength).IsRequired(); b.Property(x => x.Expiration).IsRequired(); - b.Property(x => x.Data).HasMaxLength(50000).IsRequired(); + + if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql)) + { + DeviceFlowCodesConsts.DataMaxLengthValue = 10000; //TODO: MySQL accepts 20.000. We can consider to change in v3.0. + } + b.Property(x => x.Data).HasMaxLength(DeviceFlowCodesConsts.DataMaxLengthValue).IsRequired(); b.HasIndex(x => new {x.UserCode}).IsUnique(); b.HasIndex(x => x.DeviceCode).IsUnique(); b.HasIndex(x => x.Expiration); }); + + #endregion } private static bool IsDatabaseProvider( diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs index b4b5fe9b60..093f7434dc 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs @@ -1,6 +1,7 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; @@ -14,6 +15,8 @@ namespace Volo.Abp.IdentityServer.MongoDB { public IMongoCollection ApiResources => Collection(); + public IMongoCollection ApiScopes => Collection(); + public IMongoCollection Clients => Collection(); public IMongoCollection IdentityResources => Collection(); From 9c4a3f63d37c6a17771f5b2950a8beb3f1978e77 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Fri, 3 Jul 2020 18:31:37 +0800 Subject: [PATCH 06/32] Refactor. --- .../ApiResources/ApiResourceConsts.cs | 2 +- .../ApiResources/ApiResourceEto.cs | 2 +- .../ApiResources/ApiResourceScopeConsts.cs | 2 +- .../ApiResources/ApiResourceSecretConsts.cs | 2 +- .../AbpIdentityServerDomainModule.cs | 2 +- .../ApiResources/ApiResource.cs | 2 +- .../ApiResources/ApiResourceClaim.cs | 2 +- .../ApiResources/ApiResourceScope.cs | 2 +- .../ApiResources/ApiResourceSecret.cs | 2 +- .../ApiResources/IApiResourceRepository.cs | 2 +- .../Abp/IdentityServer/ApiScopes/ApiScope.cs | 20 ++++++++++++ .../IdentityServerAutoMapperProfile.cs | 1 - .../Volo/Abp/IdentityServer/ResourceStore.cs | 7 ++-- ...IdentityServerEfCoreQueryableExtensions.cs | 15 ++++++++- .../ApiResources/ApiResourceRepository.cs | 2 +- .../ApiScopeRepository.cs | 7 ++-- ...IdentityServerEntityFrameworkCoreModule.cs | 2 +- .../IIdentityServerDbContext.cs | 1 - .../IdentityServerDbContext.cs | 1 - ...yServerDbContextModelCreatingExtensions.cs | 3 +- .../AbpIdentityServerMongoDbContext.cs | 3 +- ...pIdentityServerMongoDbContextExtensions.cs | 12 +++++-- .../MongoDB/AbpIdentityServerMongoDbModule.cs | 7 ++-- .../IAbpIdentityServerMongoDbContext.cs | 5 ++- .../MongoDB/MongoApiResourceRepository.cs | 2 +- .../MongoDB/MongoApiScopeRepository.cs | 32 +++++++++++++++++++ .../AbpIdentityServerTestDataBuilder.cs | 4 +-- .../AbpIdentityServerTestDataBuilder.cs | 2 +- .../ApiResourceRepository_Tests.cs | 2 +- 29 files changed, 109 insertions(+), 39 deletions(-) rename modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/{ApiResources => ApiScopes}/ApiScopeRepository.cs (80%) create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceConsts.cs index 1c3aecc531..b20b743b50 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceConsts.cs @@ -1,4 +1,4 @@ -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiResourceConsts { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceEto.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceEto.cs index 1130b0bc92..1aeb83727f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceEto.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceEto.cs @@ -1,7 +1,7 @@ using System; using JetBrains.Annotations; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { [Serializable] public class ApiResourceEto diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceScopeConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceScopeConsts.cs index 8b0d8f4769..c9b874b12c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceScopeConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceScopeConsts.cs @@ -1,4 +1,4 @@ -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiResourceScopeConsts { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs index 261f48ac2e..dce950d30c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs @@ -1,4 +1,4 @@ -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiResourceSecretConsts { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index 9e36576e56..bd03a3f34e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -8,7 +8,7 @@ using Volo.Abp.BackgroundWorkers; using Volo.Abp.Caching; using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Identity; -using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.IdentityResources; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs index dc795fb09b..9d81b95def 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs @@ -5,7 +5,7 @@ using IdentityServer4; using JetBrains.Annotations; using Volo.Abp.Domain.Entities.Auditing; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiResource : FullAuditedAggregateRoot { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs index e71d694656..e3e92d0721 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs @@ -1,7 +1,7 @@ using System; using JetBrains.Annotations; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiResourceClaim : UserClaim { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs index 4da2beaa3f..ecdff780e9 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs @@ -2,7 +2,7 @@ using JetBrains.Annotations; using Volo.Abp.Domain.Entities; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiResourceScope : Entity { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs index dcc6b04768..ccf63b8a3c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs @@ -2,7 +2,7 @@ using IdentityServer4; using JetBrains.Annotations; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiResourceSecret : Secret { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs index 8b9057d129..4f2abd3aed 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public interface IApiResourceRepository : IBasicRepository { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs index d35294c27f..047c688b67 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs @@ -74,5 +74,25 @@ namespace Volo.Abp.IdentityServer.ApiScopes { return UserClaims.FirstOrDefault(r => r.Name == Name && r.Type == type); } + + public virtual void AddProperty([NotNull] string key, string value) + { + Properties.Add(new ApiScopeProperty(Id, key, value)); + } + + public virtual void RemoveAllProperties() + { + Properties.Clear(); + } + + public virtual void RemoveProperty(string key) + { + Properties.RemoveAll(r => r.Key == key); + } + + public virtual ApiScopeProperty FindProperty(string key) + { + return Properties.FirstOrDefault(r => r.Key == key); + } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs index 99d24e617d..34a831ca38 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Security.Claims; using AutoMapper; -using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs index 5afaaf4400..a2d13c72fd 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Threading.Tasks; using IdentityServer4.Models; using IdentityServer4.Stores; -using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.ObjectMapping; @@ -53,7 +52,7 @@ namespace Volo.Abp.IdentityServer public virtual async Task> FindApiResourcesByScopeNameAsync(IEnumerable scopeNames) { var resources = await ApiResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true); - return ObjectMapper.Map, List>(resources); + return ObjectMapper.Map, List>(resources); } /// @@ -62,7 +61,7 @@ namespace Volo.Abp.IdentityServer public virtual async Task> FindApiResourcesByNameAsync(IEnumerable apiResourceNames) { var resources = await ApiResourceRepository.FindByNameAsync(apiResourceNames.ToArray(), includeDetails: true); - return ObjectMapper.Map, List>(resources); + return ObjectMapper.Map, List>(resources); } /// @@ -76,7 +75,7 @@ namespace Volo.Abp.IdentityServer return new Resources( ObjectMapper.Map, List>(identityResources), - ObjectMapper.Map, List>(apiResources), + ObjectMapper.Map, List>(apiResources), ObjectMapper.Map, List>(apiScopes)); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs index 6e47d461e4..347b3c4d22 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs @@ -1,6 +1,6 @@ using System.Linq; using Microsoft.EntityFrameworkCore; -using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.IdentityResources; @@ -21,6 +21,19 @@ namespace Volo.Abp.IdentityServer .Include(x => x.Scopes); } + public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) + { + if (!include) + { + return queryable; + } + + return queryable + .Include(x => x.UserClaims) + .Include(x => x.Properties); + } + + public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) { if (!include) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index 74ea53d9e0..bf8a8c2df2 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -10,7 +10,7 @@ using Volo.Abp.IdentityServer.EntityFrameworkCore; using System.Linq.Dynamic.Core; using System.Runtime.InteropServices.ComTypes; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiResourceRepository : EfCoreRepository, IApiResourceRepository { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs similarity index 80% rename from modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs index 87f67ec330..9828a48d30 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs @@ -5,10 +5,9 @@ using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.EntityFrameworkCore; -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer.ApiScopes { public class ApiScopeRepository : EfCoreRepository, IApiScopeRepository { @@ -20,7 +19,9 @@ namespace Volo.Abp.IdentityServer.ApiResources public async Task> GetListByNameAsync(string[] scopeNames, bool includeDetails = false, CancellationToken cancellationToken = default) { - var query = from scope in DbSet where scopeNames.Contains(scope.Name) select scope; + var query = from scope in DbSet.IncludeDetails(includeDetails) + where scopeNames.Contains(scope.Name) + select scope; return await query.ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs index a932cd3351..4d89745874 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs index 7834db31fb..db1017b9ab 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs @@ -1,7 +1,6 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs index 686d2e0ac1..f7ccb1d309 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs @@ -1,7 +1,6 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index 26b8036aba..8d96f2c442 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -5,13 +5,12 @@ using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Modeling; using Volo.Abp.EntityFrameworkCore.ValueComparers; using Volo.Abp.EntityFrameworkCore.ValueConverters; -using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; -using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; +using ApiResource = Volo.Abp.IdentityServer.ApiScopes.ApiResource; using Client = Volo.Abp.IdentityServer.Clients.Client; using ClientClaim = Volo.Abp.IdentityServer.Clients.ClientClaim; using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs index 093f7434dc..760505e75f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs @@ -1,12 +1,11 @@ using MongoDB.Driver; using Volo.Abp.Data; -using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; +using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.MongoDB; -using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; namespace Volo.Abp.IdentityServer.MongoDB { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs index b6a20d842a..026312312a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs @@ -1,5 +1,5 @@ using System; -using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; @@ -27,15 +27,21 @@ namespace Volo.Abp.IdentityServer.MongoDB b.CollectionName = options.CollectionPrefix + "ApiResources"; }); - builder.Entity(b => + builder.Entity(b => { - b.CollectionName = options.CollectionPrefix + "Clients"; + b.CollectionName = options.CollectionPrefix + "ApiScopes"; }); + builder.Entity(b => { b.CollectionName = options.CollectionPrefix + "IdentityResources"; }); + builder.Entity(b => + { + b.CollectionName = options.CollectionPrefix + "Clients"; + }); + builder.Entity(b => { b.CollectionName = options.CollectionPrefix + "PersistedGrants"; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs index 251378e087..1924ad3a68 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs @@ -1,11 +1,11 @@ using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.IdentityServer.ApiScopes; +using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; +using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.Modularity; using Volo.Abp.MongoDB; -using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; -using Client = Volo.Abp.IdentityServer.Clients.Client; -using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; namespace Volo.Abp.IdentityServer.MongoDB { @@ -30,6 +30,7 @@ namespace Volo.Abp.IdentityServer.MongoDB context.Services.AddMongoDbContext(options => { options.AddRepository(); + options.AddRepository(); options.AddRepository(); options.AddRepository(); options.AddRepository(); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs index 3bb21a8198..ad1cfbfcf5 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs @@ -1,11 +1,12 @@ using MongoDB.Driver; using Volo.Abp.Data; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.MongoDB; -using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; +using ApiResource = Volo.Abp.IdentityServer.ApiScopes.ApiResource; namespace Volo.Abp.IdentityServer.MongoDB { @@ -14,6 +15,8 @@ namespace Volo.Abp.IdentityServer.MongoDB { IMongoCollection ApiResources { get; } + IMongoCollection ApiScopes { get; } + IMongoCollection Clients { get; } IMongoCollection IdentityResources { get; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index 44375fce93..c7a93cdb60 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using MongoDB.Driver; using MongoDB.Driver.Linq; using Volo.Abp.Domain.Repositories.MongoDB; -using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using System.Linq.Dynamic.Core; using Volo.Abp.MongoDB; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs new file mode 100644 index 0000000000..5efa8a5a48 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using System.Linq; +using MongoDB.Driver; +using MongoDB.Driver.Linq; +using Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.IdentityServer.ApiScopes; +using Volo.Abp.MongoDB; + +namespace Volo.Abp.IdentityServer.MongoDB +{ + public class MongoApiScopeRepository : MongoDbRepository, + IApiScopeRepository + { + public MongoApiScopeRepository(IMongoDbContextProvider dbContextProvider) : + base(dbContextProvider) + { + } + + public async Task> GetListByNameAsync(string[] scopeNames, bool includeDetails = false, + CancellationToken cancellationToken = default) + { + var query = from scope in GetMongoQueryable() + where scopeNames.Contains(scope.Name) + select scope; + + return await query.ToListAsync(GetCancellationToken(cancellationToken)); + } + } +} diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index d2efa7b352..52fbc0513a 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -2,11 +2,11 @@ using IdentityServer4.Models; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; -using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; -using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; +using ApiResource = Volo.Abp.IdentityServer.ApiScopes.ApiResource; using Client = Volo.Abp.IdentityServer.Clients.Client; using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; using PersistedGrant = Volo.Abp.IdentityServer.Grants.PersistedGrant; diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index 21e7123abe..a2cf0f428c 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using Volo.Abp.Identity; -using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs index 76fbba2504..d3350ab59f 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Shouldly; -using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.Modularity; using Xunit; From 1b9a9b67221d4f0547a462a2556e125a0af8fb76 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Fri, 3 Jul 2020 20:05:30 +0800 Subject: [PATCH 07/32] Update IdentityServerDataSeedContributor.cs. --- .../IdentityServer/IdentityServerDataSeedContributor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs index 593169ae48..5c4da23953 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs @@ -6,7 +6,7 @@ using Volo.Abp.Authorization.Permissions; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; -using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.PermissionManagement; From c77856c7c685489e51a3e764951d7314daf9260f Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Fri, 3 Jul 2020 20:36:13 +0800 Subject: [PATCH 08/32] Update IdentityServerDataSeedContributor.cs. --- .../IdentityServer/IdentityServerDataSeedContributor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs index 2bce06c77d..511a20b3ea 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs @@ -7,12 +7,12 @@ using Volo.Abp.Authorization.Permissions; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; -using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.PermissionManagement; using Volo.Abp.Uow; -using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; +using ApiResource = Volo.Abp.IdentityServer.ApiScopes.ApiResource; using Client = Volo.Abp.IdentityServer.Clients.Client; namespace MyCompanyName.MyProjectName.IdentityServer From b8719fbc157f043156cce2556632e513a397ebe4 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Mon, 6 Jul 2020 22:23:19 +0800 Subject: [PATCH 09/32] Update Consent. --- .../Pages/Consent.cshtml | 38 +-- .../Pages/Consent.cshtml.cs | 21 +- .../Volo.Abp.IdentityServer.Domain.csproj | 4 +- .../Abp/IdentityServer/ApiScopes/ApiScope.cs | 4 +- .../ApiScopes/IApiScopeeRepository.cs | 6 + .../ApiScopes/ApiScopeRepository.cs | 5 + .../MongoDB/MongoApiScopeRepository.cs | 5 + .../IdentityServerDataSeedContributor.cs | 18 +- ....cs => 20200706091528_Initial.Designer.cs} | 247 ++++++++++++++---- ...2_Initial.cs => 20200706091528_Initial.cs} | 179 +++++++++---- ...ectNameMigrationsDbContextModelSnapshot.cs | 245 +++++++++++++---- .../MyProjectNameIdentityServerModule.cs | 3 +- 12 files changed, 594 insertions(+), 181 deletions(-) rename templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/{20200624023152_Initial.Designer.cs => 20200706091528_Initial.Designer.cs} (90%) rename templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/{20200624023152_Initial.cs => 20200706091528_Initial.cs} (90%) diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml index d92e72532e..5060e55a99 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml @@ -1,5 +1,4 @@ @page -@using IdentityServer4.Extensions @using Volo.Abp.Account.Web.Pages @model ConsentModel @@ -31,28 +30,29 @@
    - @foreach (var identityScope in Model.Consent.IdentityScopes) + @for (var i = 0; i < Model.Consent.IdentityScopes.Count; i++) {
  • -
    - @* TODO: Use attributes on the view model instead of using hidden here *@ - @if (identityScope.Description != null) + @* TODO: Use attributes on the view model instead of using hidden here *@ + @if (Model.Consent.IdentityScopes[i].Description != null) { }
  • } +
} @@ -62,24 +62,24 @@
public static int KeyMaxLength { get; set; } = 200; - + /// /// Default value: 50 /// public static int TypeMaxLength { get; set; } = 50; - + /// /// Default value: 200 /// public static int SubjectIdMaxLength { get; set; } = 200; - + + /// + /// Default value: 100 + /// + public static int SessionIdMaxLength { get; set; } = 100; + /// /// Default value: 200 /// public static int ClientIdMaxLength { get; set; } = 200; - + + /// + /// Default value: 200 + /// + public static int DescriptionMaxLength { get; set; } = 200; + /// /// Default value: 50000 /// public static int DataMaxLength { get; set; } = 50000; - + /// /// Default value: 50000 /// public static int DataMaxLengthValue { get; set; } = 50000; } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceConsts.cs index a7c713e161..66f8120b6a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceConsts.cs @@ -6,15 +6,15 @@ /// Default value: 200 ///
public static int NameMaxLength { get; set; } = 200; - + /// /// Default value: 200 /// public static int DisplayNameMaxLength { get; set; } = 200; - + /// - /// Default value: 200 + /// Default value: 1000 /// public static int DescriptionMaxLength { get; set; } = 1000; } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourcePropertyConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourcePropertyConsts.cs index 2c9ccbb0c4..98a5a93941 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourcePropertyConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourcePropertyConsts.cs @@ -2,8 +2,8 @@ { public class IdentityResourcePropertyConsts { - public const int KeyMaxLength = 250; - public const int ValueMaxLength = 2000; - public static int ValueMaxLengthValue { get; set; } = ValueMaxLength; + public static int KeyMaxLength { get; set; } = 250; + + public static int ValueMaxLength { get; set; } = 2000; } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/ObjectExtending/IdentityServerModuleExtensionConfiguration.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/ObjectExtending/IdentityServerModuleExtensionConfiguration.cs index 78a26900c9..fe89b7400a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/ObjectExtending/IdentityServerModuleExtensionConfiguration.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/ObjectExtending/IdentityServerModuleExtensionConfiguration.cs @@ -23,6 +23,15 @@ namespace Volo.Abp.ObjectExtending ); } + public IdentityServerModuleExtensionConfiguration ConfigureApiScope( + Action configureAction) + { + return this.ConfigureEntity( + IdentityServerModuleExtensionConsts.EntityNames.ApiScope, + configureAction + ); + } + public IdentityServerModuleExtensionConfiguration ConfigureIdentityResource( Action configureAction) { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/ObjectExtending/IdentityServerModuleExtensionConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/ObjectExtending/IdentityServerModuleExtensionConsts.cs index 8623b8830a..a9396ff95a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/ObjectExtending/IdentityServerModuleExtensionConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/ObjectExtending/IdentityServerModuleExtensionConsts.cs @@ -11,6 +11,8 @@ public const string IdentityResource = "IdentityResource"; public const string ApiResource = "ApiResource"; + + public const string ApiScope = "ApiScope"; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index bd03a3f34e..d07132e094 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -8,6 +8,7 @@ using Volo.Abp.BackgroundWorkers; using Volo.Abp.Caching; using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Identity; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs index 9d81b95def..e6fe3b9318 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs @@ -4,6 +4,7 @@ using System.Linq; using IdentityServer4; using JetBrains.Annotations; using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.IdentityServer.ApiResources; namespace Volo.Abp.IdentityServer.ApiScopes { @@ -28,7 +29,7 @@ namespace Volo.Abp.IdentityServer.ApiScopes public virtual List UserClaims { get; protected set; } - public virtual Dictionary Properties { get; protected set; } + public virtual List Properties { get; protected set; } protected ApiResource() { @@ -51,7 +52,7 @@ namespace Volo.Abp.IdentityServer.ApiScopes Secrets = new List(); Scopes = new List(); UserClaims = new List(); - Properties = new Dictionary(); + Properties = new List(); Scopes.Add(new ApiResourceScope(id, name)); } @@ -121,5 +122,25 @@ namespace Volo.Abp.IdentityServer.ApiScopes { return Scopes.FirstOrDefault(r => r.Scope == scope); } + + public virtual void AddProperty([NotNull] string key, string value) + { + Properties.Add(new ApiResourceProperty(Id, key, value)); + } + + public virtual void RemoveAllProperties() + { + Properties.Clear(); + } + + public virtual void RemoveProperty(string key) + { + Properties.RemoveAll(r => r.Key == key); + } + + public virtual ApiResourceProperty FindProperty(string key) + { + return Properties.FirstOrDefault(r => r.Key == key); + } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceProperty.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceProperty.cs new file mode 100644 index 0000000000..7b6257c771 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceProperty.cs @@ -0,0 +1,39 @@ +using System; +using JetBrains.Annotations; +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.IdentityServer.ApiResources +{ + public class ApiResourceProperty : Entity + { + public virtual Guid ApiResourceId { get; protected set; } + + public virtual string Key { get; set; } + + public virtual string Value { get; set; } + + protected ApiResourceProperty() + { + + } + + public virtual bool Equals(Guid aiResourceId, [NotNull] string key, string value) + { + return ApiResourceId == aiResourceId && Key == key && Value == value; + } + + protected internal ApiResourceProperty(Guid aiResourceId, [NotNull] string key, [NotNull] string value) + { + Check.NotNull(key, nameof(key)); + + ApiResourceId = aiResourceId; + Key = key; + Value = value; + } + + public override object[] GetKeys() + { + return new object[] { ApiResourceId, Key }; + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs index 4f2abd3aed..f2feff8917 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs @@ -35,11 +35,6 @@ namespace Volo.Abp.IdentityServer.ApiScopes CancellationToken cancellationToken = default ); - Task> GetListAsync( - bool includeDetails = false, - CancellationToken cancellationToken = default - ); - Task CheckNameExistAsync( string name, Guid? expectedId = null, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs index 2f183b8b7e..27f8ad1d58 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScope.cs @@ -59,7 +59,7 @@ namespace Volo.Abp.IdentityServer.ApiScopes public virtual void AddUserClaim([NotNull] string type) { - UserClaims.Add(new ApiScopeClaim(Id, Name, type)); + UserClaims.Add(new ApiScopeClaim(Id, type)); } public virtual void RemoveAllUserClaims() @@ -74,7 +74,7 @@ namespace Volo.Abp.IdentityServer.ApiScopes public virtual ApiScopeClaim FindClaim(string type) { - return UserClaims.FirstOrDefault(r => r.Name == Name && r.Type == type); + return UserClaims.FirstOrDefault(r => r.Type == type); } public virtual void AddProperty([NotNull] string key, string value) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaim.cs index 0bb6704a22..95519195e7 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaim.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/ApiScopeClaim.cs @@ -7,31 +7,25 @@ namespace Volo.Abp.IdentityServer.ApiScopes { public Guid ApiScopeId { get; protected set; } - [NotNull] - public string Name { get; protected set; } - protected ApiScopeClaim() { } - public virtual bool Equals(Guid apiScopeId, [NotNull] string name, [NotNull] string type) + public virtual bool Equals(Guid apiScopeId, [NotNull] string type) { - return ApiScopeId == apiScopeId && Name == name && Type == type; + return ApiScopeId == apiScopeId && Type == type; } - protected internal ApiScopeClaim(Guid apiScopeId, [NotNull] string name, [NotNull] string type) + protected internal ApiScopeClaim(Guid apiScopeId, [NotNull] string type) : base(type) { - Check.NotNull(name, nameof(name)); - ApiScopeId = apiScopeId; - Name = name; } public override object[] GetKeys() { - return new object[] { ApiScopeId, Name, Type }; + return new object[] { ApiScopeId, Type }; } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceProperty.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceProperty.cs index d351addfc2..4480fdab5a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceProperty.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceProperty.cs @@ -17,9 +17,9 @@ namespace Volo.Abp.IdentityServer.IdentityResources } - public virtual bool Equals(Guid identityResourceId, [NotNull] string key) + public virtual bool Equals(Guid identityResourceId, [NotNull] string key, string value) { - return IdentityResourceId == identityResourceId && Key == key; + return IdentityResourceId == identityResourceId && Key == key && Value == value; } protected internal IdentityResourceProperty(Guid identityResourceId, [NotNull] string key, [NotNull] string value) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs index 34a831ca38..af155190f3 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Security.Claims; using AutoMapper; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; @@ -11,58 +12,32 @@ namespace Volo.Abp.IdentityServer { public class IdentityServerAutoMapperProfile : Profile { + /// + /// TODO: Reverse maps will not used probably. Remove those will not used + /// public IdentityServerAutoMapperProfile() { - //TODO: Reverse maps will not used probably. Remove those will not used - - CreateMap() - .ConstructUsing(src => src.Origin) - .ReverseMap() - .ForMember(dest => dest.Origin, opt => opt.MapFrom(src => src)); - - CreateMap() - .ForMember(dest => dest.ApiSecrets, opt => opt.MapFrom(src => src.Secrets)); - - CreateMap(); - - - //TODO: Why PersistedGrant mapping is in this profile? - CreateMap().ReverseMap(); - - CreateMap() - .ConstructUsing(src => new IdentityServer4.Models.IdentityResource()); - - CreateMap() - .ConstructUsing(x => x.Type) - .ReverseMap() - .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src)); - - CreateMap>() - .ReverseMap(); - CreateMap() .ConstructUsing(src => src.Type) .ReverseMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src)); - CreateMap() - .ConstructUsing(x => x.Scope) - .ReverseMap() - .ForMember(dest => dest.Scope, opt => opt.MapFrom(src => src)); - - CreateMap>() - .ReverseMap(); + CreateClientMap(); + CreateApiResourceMap(); + CreateApiScopeMap(); + CreateIdentityResourceMap(); + CreatePersistedGrantMap(); + CreateDeviceFlowCodesMap(); + } - CreateMap() - .ConstructUsing(x => x.Type) + private void CreateClientMap() + { + CreateMap() + .ConstructUsing(src => src.Origin) .ReverseMap() - .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src)); - - CreateMap(MemberList.Destination) - .ConstructUsing(src => new IdentityServer4.Models.ApiScope()) - .ReverseMap(); + .ForMember(dest => dest.Origin, opt => opt.MapFrom(src => src)); - CreateMap>() + CreateMap>() .ReverseMap(); CreateMap() @@ -115,10 +90,64 @@ namespace Volo.Abp.IdentityServer CreateMap(); CreateMap(); - CreateMap(); - CreateMap(); + } + + private void CreateApiResourceMap() + { + CreateMap() + .ForMember(dest => dest.ApiSecrets, opt => opt.MapFrom(src => src.Secrets)); + + CreateMap(); + + CreateMap() + .ConstructUsing(x => x.Scope) + .ReverseMap() + .ForMember(dest => dest.Scope, opt => opt.MapFrom(src => src)); + + CreateMap(); + } + + private void CreateApiScopeMap() + { + CreateMap>() + .ReverseMap(); + + CreateMap() + .ConstructUsing(x => x.Type) + .ReverseMap() + .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src)); + + CreateMap(MemberList.Destination) + .ConstructUsing(src => new IdentityServer4.Models.ApiScope()) + .ReverseMap(); + } + + private void CreateIdentityResourceMap() + { + CreateMap() + .ConstructUsing(src => new IdentityServer4.Models.IdentityResource()); + + CreateMap() + .ConstructUsing(x => x.Type) + .ReverseMap() + .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src)); + + CreateMap>() + .ReverseMap(); + CreateMap(); + } + + private void CreatePersistedGrantMap() + { + //TODO: Why PersistedGrant mapping is in this profile? + CreateMap().ReverseMap(); + CreateMap(); + } + private void CreateDeviceFlowCodesMap() + { + CreateMap(); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs index 347b3c4d22..d830da07e0 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs @@ -18,7 +18,8 @@ namespace Volo.Abp.IdentityServer return queryable .Include(x => x.Secrets) .Include(x => x.UserClaims) - .Include(x => x.Scopes); + .Include(x => x.Scopes) + .Include(x => x.Properties); } public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index bf8a8c2df2..53644a1e1c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -67,15 +67,6 @@ namespace Volo.Abp.IdentityServer.ApiScopes .ToListAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task> GetListAsync( - bool includeDetails = false, - CancellationToken cancellationToken = default) - { - return await DbSet - .IncludeDetails(includeDetails) - .ToListAsync(GetCancellationToken(cancellationToken)); - } - public virtual async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { return await DbSet.AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs index 4d89745874..fd22e97fe4 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs @@ -33,6 +33,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore options.AddRepository(); options.AddRepository(); + options.AddRepository(); options.AddRepository(); options.AddRepository(); options.AddRepository(); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs index db1017b9ab..3178fa02f2 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs @@ -34,7 +34,6 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore #endregion - #region IdentityResource DbSet IdentityResources { get; set; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs index f7ccb1d309..c8dc32b183 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs @@ -34,7 +34,6 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore #endregion - #region IdentityResource public DbSet IdentityResources { get; set; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index 8d96f2c442..b2dba48e15 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -1,10 +1,8 @@ using System; -using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Modeling; -using Volo.Abp.EntityFrameworkCore.ValueComparers; -using Volo.Abp.EntityFrameworkCore.ValueConverters; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; @@ -188,31 +186,6 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.Value).HasMaxLength(ClientPropertyConsts.ValueMaxLength).IsRequired(); }); - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "PersistedGrants", options.Schema); - - b.ConfigureByConvention(); - - b.Property(x => x.Key).HasMaxLength(PersistedGrantConsts.KeyMaxLength).ValueGeneratedNever(); - b.Property(x => x.Type).HasMaxLength(PersistedGrantConsts.TypeMaxLength).IsRequired(); - b.Property(x => x.SubjectId).HasMaxLength(PersistedGrantConsts.SubjectIdMaxLength); - b.Property(x => x.ClientId).HasMaxLength(PersistedGrantConsts.ClientIdMaxLength).IsRequired(); - b.Property(x => x.CreationTime).IsRequired(); - - if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql)) - { - PersistedGrantConsts.DataMaxLengthValue = 10000; //TODO: MySQL accepts 20.000. We can consider to change in v3.0. - } - - b.Property(x => x.Data).HasMaxLength(PersistedGrantConsts.DataMaxLengthValue).IsRequired(); - - b.HasKey(x => x.Key); //TODO: What about Id!!! - - b.HasIndex(x => new {x.SubjectId, x.ClientId, x.Type}); - b.HasIndex(x => x.Expiration); - }); - #endregion #region IdentityResource @@ -255,9 +228,9 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.Key).HasMaxLength(IdentityResourcePropertyConsts.KeyMaxLength).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { - IdentityResourcePropertyConsts.ValueMaxLengthValue = 300; + IdentityResourcePropertyConsts.ValueMaxLength = 300; } - b.Property(x => x.Value).HasMaxLength(IdentityResourcePropertyConsts.ValueMaxLengthValue).IsRequired(); + b.Property(x => x.Value).HasMaxLength(IdentityResourcePropertyConsts.ValueMaxLength).IsRequired(); }); #endregion @@ -270,16 +243,16 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.ConfigureByConvention(); + b.HasIndex(x => x.Name).IsUnique(); + b.Property(x => x.Name).HasMaxLength(ApiResourceConsts.NameMaxLength).IsRequired(); b.Property(x => x.DisplayName).HasMaxLength(ApiResourceConsts.DisplayNameMaxLength); b.Property(x => x.Description).HasMaxLength(ApiResourceConsts.DescriptionMaxLength); - b.Property(x => x.Properties) - .HasConversion(new AbpJsonValueConverter>()) - .Metadata.SetValueComparer(new AbpDictionaryValueComparer()); b.HasMany(x => x.Secrets).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); b.HasMany(x => x.Scopes).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); b.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); + b.HasMany(x => x.Properties).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); }); builder.Entity(b => @@ -291,14 +264,14 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.ApiResourceId, x.Type, x.Value}); b.Property(x => x.Type).HasMaxLength(ApiResourceSecretConsts.TypeMaxLength).IsRequired(); - b.Property(x => x.Description).HasMaxLength(ApiResourceSecretConsts.DescriptionMaxLength); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { ApiResourceSecretConsts.ValueMaxLengthValue = 300; } - b.Property(x => x.Value).HasMaxLength(ApiResourceSecretConsts.ValueMaxLengthValue).IsRequired(); + + b.Property(x => x.Description).HasMaxLength(ApiResourceSecretConsts.DescriptionMaxLength); }); builder.Entity(b => @@ -323,6 +296,22 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.Scope).HasMaxLength(ApiResourceScopeConsts.ScopeMaxLength).IsRequired(); }); + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "ApiResourceProperties", options.Schema); + + b.ConfigureByConvention(); + + b.HasKey(x => new {x.ApiResourceId, x.Key}); + + b.Property(x => x.Key).HasMaxLength(ApiResourcePropertyConsts.KeyMaxLength).IsRequired(); + if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) + { + ApiResourcePropertyConsts.ValueMaxLength = 300; + } + b.Property(x => x.Value).HasMaxLength(ApiResourcePropertyConsts.ValueMaxLength).IsRequired(); + }); + #endregion #region ApiScope @@ -340,9 +329,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasIndex(x => x.Name).IsUnique(); b.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.ApiScopeId).IsRequired(); - - //TODO: Identity Server does not configure the relationship of Properties - //b.HasMany(x => x.Properties).WithOne().HasForeignKey(x => x.ApiScopeId).IsRequired(); + b.HasMany(x => x.Properties).WithOne().HasForeignKey(x => x.ApiScopeId).IsRequired(); }); builder.Entity(b => @@ -351,10 +338,9 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.ConfigureByConvention(); - b.HasKey(x => new {x.ApiScopeId, x.Name, x.Type}); + b.HasKey(x => new {x.ApiScopeId, x.Type}); b.Property(x => x.Type).HasMaxLength(UserClaimConsts.TypeMaxLength).IsRequired(); - b.Property(x => x.Name).HasMaxLength(ApiScopeClaimConsts.NameMaxLength).IsRequired(); }); builder.Entity(b => @@ -368,9 +354,41 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.Key).HasMaxLength(ApiScopePropertyConsts.KeyMaxLength).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { - ApiScopePropertyConsts.ValueMaxLengthValue = 300; + ApiScopePropertyConsts.ValueMaxLength = 300; } - b.Property(x => x.Value).HasMaxLength(ApiScopePropertyConsts.ValueMaxLengthValue).IsRequired(); + b.Property(x => x.Value).HasMaxLength(ApiScopePropertyConsts.ValueMaxLength).IsRequired(); + }); + + #endregion + + #region PersistedGrant + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "PersistedGrants", options.Schema); + + b.ConfigureByConvention(); + + b.Property(x => x.Key).HasMaxLength(PersistedGrantConsts.KeyMaxLength).ValueGeneratedNever(); + b.Property(x => x.Type).HasMaxLength(PersistedGrantConsts.TypeMaxLength).IsRequired(); + b.Property(x => x.SubjectId).HasMaxLength(PersistedGrantConsts.SubjectIdMaxLength); + b.Property(x => x.SessionId).HasMaxLength(PersistedGrantConsts.SessionIdMaxLength); + b.Property(x => x.ClientId).HasMaxLength(PersistedGrantConsts.ClientIdMaxLength).IsRequired(); + b.Property(x => x.Description).HasMaxLength(PersistedGrantConsts.DescriptionMaxLength); + b.Property(x => x.CreationTime).IsRequired(); + + if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql)) + { + PersistedGrantConsts.DataMaxLengthValue = 10000; //TODO: MySQL accepts 20.000. We can consider to change in v3.0. + } + + b.Property(x => x.Data).HasMaxLength(PersistedGrantConsts.DataMaxLengthValue).IsRequired(); + + b.HasKey(x => x.Key); //TODO: What about Id!!! + + b.HasIndex(x => new {x.SubjectId, x.ClientId, x.Type}); + b.HasIndex(x => new {x.SubjectId, x.SessionId, x.Type}); + b.HasIndex(x => x.Expiration); }); #endregion @@ -386,16 +404,19 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.DeviceCode).HasMaxLength(DeviceFlowCodesConsts.DeviceCodeMaxLength).IsRequired(); b.Property(x => x.UserCode).HasMaxLength(DeviceFlowCodesConsts.UserCodeMaxLength).IsRequired(); b.Property(x => x.SubjectId).HasMaxLength(DeviceFlowCodesConsts.SubjectIdMaxLength); + b.Property(x => x.SessionId).HasMaxLength(DeviceFlowCodesConsts.SessionIdMaxLength); b.Property(x => x.ClientId).HasMaxLength(DeviceFlowCodesConsts.ClientIdMaxLength).IsRequired(); + b.Property(x => x.Description).HasMaxLength(DeviceFlowCodesConsts.DescriptionMaxLength); + b.Property(x => x.CreationTime).IsRequired(); b.Property(x => x.Expiration).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql)) { - DeviceFlowCodesConsts.DataMaxLengthValue = 10000; //TODO: MySQL accepts 20.000. We can consider to change in v3.0. + DeviceFlowCodesConsts.DataMaxLength = 10000; //TODO: MySQL accepts 20.000. We can consider to change in v3.0. } - b.Property(x => x.Data).HasMaxLength(DeviceFlowCodesConsts.DataMaxLengthValue).IsRequired(); + b.Property(x => x.Data).HasMaxLength(DeviceFlowCodesConsts.DataMaxLength).IsRequired(); - b.HasIndex(x => new {x.UserCode}).IsUnique(); + b.HasIndex(x => new {x.UserCode}); b.HasIndex(x => x.DeviceCode).IsUnique(); b.HasIndex(x => x.Expiration); }); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs index 0662482b65..5190687342 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs @@ -182,7 +182,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer AccessTokenLifetime = 31536000, //365 days AuthorizationCodeLifetime = 300, IdentityTokenLifetime = 300, - RequireConsent = false, + RequireConsent = true, RequirePkce = false, FrontChannelLogoutUri = frontChannelLogoutUri }, From b2beaa2b0cf3e3ead74a2dffda34e5bedce47aaf Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 7 Jul 2020 11:34:07 +0800 Subject: [PATCH 11/32] Update IdentityServerDataSeedContributor. --- .../IdentityServerDataSeedContributor.cs | 2 +- .../IdentityServerDataSeedContributor.cs | 54 +++++++++++++------ 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs index 5190687342..0662482b65 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs @@ -182,7 +182,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer AccessTokenLifetime = 31536000, //365 days AuthorizationCodeLifetime = 300, IdentityTokenLifetime = 300, - RequireConsent = true, + RequireConsent = false, RequirePkce = false, FrontChannelLogoutUri = frontChannelLogoutUri }, diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs index 5c4da23953..7937265409 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs @@ -1,7 +1,8 @@ -using Microsoft.Extensions.Configuration; -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; +using IdentityServer4.Models; +using Microsoft.Extensions.Configuration; using Volo.Abp.Authorization.Permissions; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; @@ -11,12 +12,16 @@ using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.PermissionManagement; using Volo.Abp.Uow; +using ApiResource = Volo.Abp.IdentityServer.ApiScopes.ApiResource; +using ApiScope = Volo.Abp.IdentityServer.ApiScopes.ApiScope; +using Client = Volo.Abp.IdentityServer.Clients.Client; namespace MyCompanyName.MyProjectName.IdentityServer { public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransientDependency { private readonly IApiResourceRepository _apiResourceRepository; + private readonly IApiScopeRepository _apiScopeRepository; private readonly IClientRepository _clientRepository; private readonly IIdentityResourceDataSeeder _identityResourceDataSeeder; private readonly IGuidGenerator _guidGenerator; @@ -26,6 +31,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer public IdentityServerDataSeedContributor( IClientRepository clientRepository, IApiResourceRepository apiResourceRepository, + IApiScopeRepository apiScopeRepository, IIdentityResourceDataSeeder identityResourceDataSeeder, IGuidGenerator guidGenerator, IPermissionDataSeeder permissionDataSeeder, @@ -33,6 +39,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer { _clientRepository = clientRepository; _apiResourceRepository = apiResourceRepository; + _apiScopeRepository = apiScopeRepository; _identityResourceDataSeeder = identityResourceDataSeeder; _guidGenerator = guidGenerator; _permissionDataSeeder = permissionDataSeeder; @@ -44,6 +51,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer { await _identityResourceDataSeeder.CreateStandardResourcesAsync(); await CreateApiResourcesAsync(); + await CreateApiScopeAsync(); await CreateClientsAsync(); } @@ -88,10 +96,17 @@ namespace MyCompanyName.MyProjectName.IdentityServer return await _apiResourceRepository.UpdateAsync(apiResource); } - private async Task CreateClientsAsync() + private async Task CreateApiScopeAsync() { - const string commonSecret = "E5Xd4yMqjP5kjWFKrYgySBju6JVfCzMyFp7n2QmMrME="; + var apiScope = await _apiScopeRepository.GetByNameAsync("MyProjectName"); + if (apiScope == null) + { + await _apiScopeRepository.InsertAsync(new ApiScope(_guidGenerator.Create(), "MyProjectName", "MyProjectName API"), autoSave: true); + } + } + private async Task CreateClientsAsync() + { var commonScopes = new[] { "email", @@ -100,6 +115,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer "role", "phone", "address", + "MyProjectName" }; @@ -110,25 +126,30 @@ namespace MyCompanyName.MyProjectName.IdentityServer if (!webClientId.IsNullOrWhiteSpace()) { var webClientRootUrl = configurationSection["MyProjectName_Web:RootUrl"].EnsureEndsWith('/'); + + /* MyProjectName_Web client is only needed if you created a tiered + * solution. Otherwise, you can delete this client. */ + await CreateClientAsync( - webClientId, - commonScopes, - new[] { "hybrid" }, - commonSecret, + name: webClientId, + scopes: commonScopes, + grantTypes: new[] {"hybrid"}, + secret: (configurationSection["MyProjectName_Web:ClientSecret"] ?? "1q2w3e*").Sha256(), redirectUri: $"{webClientRootUrl}signin-oidc", - postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc" + postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc", + frontChannelLogoutUri: $"{webClientRootUrl}Account/FrontChannelLogout" ); } //Console Test Client - var consoleClientId = configurationSection["MyProjectName_ConsoleTestApp:ClientId"]; + var consoleClientId = configurationSection["MyProjectName_App:ClientId"]; if (!consoleClientId.IsNullOrWhiteSpace()) { await CreateClientAsync( - consoleClientId, - commonScopes, - new[] { "password", "client_credentials" }, - commonSecret + name: consoleClientId, + scopes: commonScopes, + grantTypes: new[] {"password", "client_credentials"}, + secret: (configurationSection["MyProjectName_App:ClientSecret"] ?? "1q2w3e*").Sha256() ); } } @@ -140,6 +161,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer string secret, string redirectUri = null, string postLogoutRedirectUri = null, + string frontChannelLogoutUri = null, IEnumerable permissions = null) { var client = await _clientRepository.FindByCliendIdAsync(name); @@ -160,7 +182,9 @@ namespace MyCompanyName.MyProjectName.IdentityServer AccessTokenLifetime = 31536000, //365 days AuthorizationCodeLifetime = 300, IdentityTokenLifetime = 300, - RequireConsent = false + RequireConsent = false, + RequirePkce = false, + FrontChannelLogoutUri = frontChannelLogoutUri }, autoSave: true ); From cf75e6cdb3f5d92edf911fc5c879a553f9cfd19a Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 7 Jul 2020 13:09:56 +0800 Subject: [PATCH 12/32] Update app template migrations. --- ....cs => 20200707050900_Initial.Designer.cs} | 67 +++++++++++++------ ...8_Initial.cs => 20200707050900_Initial.cs} | 56 ++++++++++++---- ...ectNameMigrationsDbContextModelSnapshot.cs | 65 +++++++++++++----- 3 files changed, 138 insertions(+), 50 deletions(-) rename templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/{20200706091528_Initial.Designer.cs => 20200707050900_Initial.Designer.cs} (97%) rename templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/{20200706091528_Initial.cs => 20200707050900_Initial.cs} (96%) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.Designer.cs similarity index 97% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.Designer.cs index e3441488a9..ee4de4f358 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.Designer.cs @@ -11,7 +11,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameMigrationsDbContext))] - [Migration("20200706091528_Initial")] + [Migration("20200707050900_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -863,6 +863,25 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpOrganizationUnitRoles"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ApiResourceId", "Key"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResource", b => { b.Property("Id") @@ -928,14 +947,14 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - b.Property("ShowInDiscoveryDocument") .HasColumnType("bit"); b.HasKey("Id"); + b.HasIndex("Name") + .IsUnique(); + b.ToTable("IdentityServerApiResources"); }); @@ -981,8 +1000,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1076,15 +1095,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ApiScopeId") .HasColumnType("uniqueidentifier"); - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - b.Property("Type") .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.HasKey("ApiScopeId", "Name", "Type"); + b.HasKey("ApiScopeId", "Type"); b.ToTable("IdentityServerApiScopeClaims"); }); @@ -1426,8 +1441,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1468,7 +1483,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(50000); b.Property("Description") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("DeviceCode") .IsRequired() @@ -1484,7 +1500,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(max)"); b.Property("SessionId") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("SubjectId") .HasColumnType("nvarchar(200)") @@ -1502,8 +1519,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Expiration"); - b.HasIndex("UserCode") - .IsUnique(); + b.HasIndex("UserCode"); b.ToTable("IdentityServerDeviceFlowCodes"); }); @@ -1537,7 +1553,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(50000); b.Property("Description") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1550,7 +1567,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("SessionId") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("SubjectId") .HasColumnType("nvarchar(200)") @@ -1567,6 +1585,8 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "SessionId", "Type"); + b.ToTable("IdentityServerPersistedGrants"); }); @@ -1937,6 +1957,15 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + .WithMany("Properties") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => { b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.cs similarity index 96% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.cs index 36c8079aa1..48726d777b 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200706091528_Initial.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.cs @@ -250,8 +250,7 @@ namespace MyCompanyName.MyProjectName.Migrations Description = table.Column(maxLength: 1000, nullable: true), Enabled = table.Column(nullable: false), AllowedAccessTokenSigningAlgorithms = table.Column(nullable: true), - ShowInDiscoveryDocument = table.Column(nullable: false), - Properties = table.Column(nullable: true) + ShowInDiscoveryDocument = table.Column(nullable: false) }, constraints: table => { @@ -356,9 +355,9 @@ namespace MyCompanyName.MyProjectName.Migrations DeviceCode = table.Column(maxLength: 200, nullable: false), UserCode = table.Column(maxLength: 200, nullable: false), SubjectId = table.Column(maxLength: 200, nullable: true), - SessionId = table.Column(nullable: true), + SessionId = table.Column(maxLength: 100, nullable: true), ClientId = table.Column(maxLength: 200, nullable: false), - Description = table.Column(nullable: true), + Description = table.Column(maxLength: 200, nullable: true), Expiration = table.Column(nullable: false), Data = table.Column(maxLength: 50000, nullable: false) }, @@ -404,9 +403,9 @@ namespace MyCompanyName.MyProjectName.Migrations ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), Type = table.Column(maxLength: 50, nullable: false), SubjectId = table.Column(maxLength: 200, nullable: true), - SessionId = table.Column(nullable: true), + SessionId = table.Column(maxLength: 100, nullable: true), ClientId = table.Column(maxLength: 200, nullable: false), - Description = table.Column(nullable: true), + Description = table.Column(maxLength: 200, nullable: true), CreationTime = table.Column(nullable: false), Expiration = table.Column(nullable: true), ConsumedTime = table.Column(nullable: true), @@ -667,6 +666,25 @@ namespace MyCompanyName.MyProjectName.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "IdentityServerApiResourceProperties", + columns: table => new + { + ApiResourceId = table.Column(nullable: false), + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiResourceProperties", x => new { x.ApiResourceId, x.Key }); + table.ForeignKey( + name: "FK_IdentityServerApiResourceProperties_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "IdentityServerApiResourceScopes", columns: table => new @@ -692,7 +710,7 @@ namespace MyCompanyName.MyProjectName.Migrations Type = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 4000, nullable: false), ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -711,12 +729,11 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { Type = table.Column(maxLength: 200, nullable: false), - ApiScopeId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false) + ApiScopeId = table.Column(nullable: false) }, constraints: table => { - table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiScopeId, x.Name, x.Type }); + table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiScopeId, x.Type }); table.ForeignKey( name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiScopeId", column: x => x.ApiScopeId, @@ -897,7 +914,7 @@ namespace MyCompanyName.MyProjectName.Migrations Type = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 4000, nullable: false), ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -1096,6 +1113,12 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpUsers", column: "UserName"); + migrationBuilder.CreateIndex( + name: "IX_IdentityServerApiResources_Name", + table: "IdentityServerApiResources", + column: "Name", + unique: true); + migrationBuilder.CreateIndex( name: "IX_IdentityServerApiScopes_Name", table: "IdentityServerApiScopes", @@ -1121,8 +1144,7 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_IdentityServerDeviceFlowCodes_UserCode", table: "IdentityServerDeviceFlowCodes", - column: "UserCode", - unique: true); + column: "UserCode"); migrationBuilder.CreateIndex( name: "IX_IdentityServerIdentityResources_Name", @@ -1139,6 +1161,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", table: "IdentityServerPersistedGrants", columns: new[] { "SubjectId", "ClientId", "Type" }); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_SubjectId_SessionId_Type", + table: "IdentityServerPersistedGrants", + columns: new[] { "SubjectId", "SessionId", "Type" }); } protected override void Down(MigrationBuilder migrationBuilder) @@ -1191,6 +1218,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "IdentityServerApiResourceClaims"); + migrationBuilder.DropTable( + name: "IdentityServerApiResourceProperties"); + migrationBuilder.DropTable( name: "IdentityServerApiResourceScopes"); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs index 3e52c652ed..bfcb19749d 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs @@ -861,6 +861,25 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpOrganizationUnitRoles"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ApiResourceId", "Key"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResource", b => { b.Property("Id") @@ -926,14 +945,14 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - b.Property("ShowInDiscoveryDocument") .HasColumnType("bit"); b.HasKey("Id"); + b.HasIndex("Name") + .IsUnique(); + b.ToTable("IdentityServerApiResources"); }); @@ -979,8 +998,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1074,15 +1093,11 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ApiScopeId") .HasColumnType("uniqueidentifier"); - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - b.Property("Type") .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.HasKey("ApiScopeId", "Name", "Type"); + b.HasKey("ApiScopeId", "Type"); b.ToTable("IdentityServerApiScopeClaims"); }); @@ -1424,8 +1439,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1466,7 +1481,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(50000); b.Property("Description") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("DeviceCode") .IsRequired() @@ -1482,7 +1498,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(max)"); b.Property("SessionId") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("SubjectId") .HasColumnType("nvarchar(200)") @@ -1500,8 +1517,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Expiration"); - b.HasIndex("UserCode") - .IsUnique(); + b.HasIndex("UserCode"); b.ToTable("IdentityServerDeviceFlowCodes"); }); @@ -1535,7 +1551,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(50000); b.Property("Description") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1548,7 +1565,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("SessionId") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("SubjectId") .HasColumnType("nvarchar(200)") @@ -1565,6 +1583,8 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "SessionId", "Type"); + b.ToTable("IdentityServerPersistedGrants"); }); @@ -1935,6 +1955,15 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + .WithMany("Properties") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => { b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) From 7a885cfe9abec492bb2483ed01076ace8e1b83dd Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 7 Jul 2020 14:31:30 +0800 Subject: [PATCH 13/32] Update Consent page. --- .../ConsentOptions.cs | 17 -- .../Pages/Consent.cshtml | 74 +++--- .../Pages/Consent.cshtml.cs | 243 ++++++++---------- .../Pages/Account/LoggedOut.cshtml | 6 +- 4 files changed, 142 insertions(+), 198 deletions(-) delete mode 100644 modules/account/src/Volo.Abp.Account.Web.IdentityServer/ConsentOptions.cs diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/ConsentOptions.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/ConsentOptions.cs deleted file mode 100644 index 3aaafd5d11..0000000000 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/ConsentOptions.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Volo.Abp.Account.Web -{ - public class ConsentOptions - { - public static bool EnableOfflineAccess = true; - - public static string OfflineAccessDisplayName = "Offline Access"; - - public static string OfflineAccessDescription = "Access to your applications and resources, even when you are offline"; - - //TODO: How to handle this - public static readonly string MustChooseOneErrorMessage = "You must pick at least one permission"; - - //TODO: How to handle this - public static readonly string InvalidSelectionErrorMessage = "Invalid selection"; - } -} diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml index 5060e55a99..8fb7e918e1 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml @@ -1,17 +1,18 @@ @page @using Volo.Abp.Account.Web.Pages +@using Volo.Abp.Account.Web.Pages.Account @model ConsentModel

- @if (Model.Consent.ClientLogoUrl != null) + @if (Model.ClientInfo.ClientLogoUrl != null) { - + } - @Model.Consent.ClientName + @Model.ClientInfo.ClientName is requesting your permission

@@ -24,62 +25,59 @@
Uncheck the permissions you do not wish to grant.
- @if (!Model.Consent.IdentityScopes.IsNullOrEmpty()) + @if (!Model.ConsentInput.IdentityScopes.IsNullOrEmpty()) {

Personal Information

    - - @for (var i = 0; i < Model.Consent.IdentityScopes.Count; i++) + @for (var i = 0; i < Model.ConsentInput.IdentityScopes.Count; i++) {
  • -
    - @* TODO: Use attributes on the view model instead of using hidden here *@ - @if (Model.Consent.IdentityScopes[i].Description != null) + @* TODO: Use attributes on the view model instead of using hidden here *@ + @if (Model.ConsentInput.IdentityScopes[i].Description != null) { }
  • } -
} - @if (!Model.Consent.ApiScopes.IsNullOrEmpty()) + @if (!Model.ConsentInput.ApiScopes.IsNullOrEmpty()) {

Application Access

    - - @for (var i = 0; i < Model.Consent.ApiScopes.Count; i++) + @for (var i = 0; i < Model.ConsentInput.ApiScopes.Count; i++) {
  • -
    - @* TODO: Use attributes on the view model instead of using hidden here *@ - @if (Model.Consent.ApiScopes[i].Description != null) + @* TODO: Use attributes on the view model instead of using hidden here *@ + @if (Model.ConsentInput.ApiScopes[i].Description != null) { }
  • @@ -87,35 +85,23 @@
} -
-
-
- - Description -
-
- -
-
-
- - @if (Model.Consent.AllowRememberConsent) + @if (Model.ClientInfo.AllowRememberConsent) {
-
}
diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs index d957e3b84a..a1faba16a7 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs @@ -3,13 +3,13 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; -using IdentityServer4.Extensions; using IdentityServer4.Models; using IdentityServer4.Services; using IdentityServer4.Stores; using IdentityServer4.Validation; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.UI; namespace Volo.Abp.Account.Web.Pages { @@ -25,7 +25,9 @@ namespace Volo.Abp.Account.Web.Pages public string ReturnUrlHash { get; set; } [BindProperty] - public ConsentViewModel Consent { get; set; } + public ConsentModel.ConsentInputModel ConsentInput { get; set; } + + public ClientInfoModel ClientInfo { get; set; } private readonly IIdentityServerInteractionService _interaction; private readonly IClientStore _clientStore; @@ -43,7 +45,49 @@ namespace Volo.Abp.Account.Web.Pages public virtual async Task OnGet() { - Consent = await BuildViewModelAsync(ReturnUrl); + var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); + if (request == null) + { + throw new ApplicationException($"No consent request matching request: {ReturnUrl}"); + } + + var client = await _clientStore.FindEnabledClientByIdAsync(request.Client.ClientId); + if (client == null) + { + throw new ApplicationException($"Invalid client id: {request.Client.ClientId}"); + } + + var resources = await _resourceStore.FindEnabledResourcesByScopeAsync(request.ValidatedResources.RawScopeValues); + if (resources == null || (!resources.IdentityResources.Any() && !resources.ApiResources.Any())) + { + throw new ApplicationException($"No scopes matching: {request.ValidatedResources.RawScopeValues.Aggregate((x, y) => x + ", " + y)}"); + } + + ClientInfo = new ClientInfoModel(client); + ConsentInput = new ConsentInputModel + { + RememberConsent = true, + IdentityScopes = resources.IdentityResources.Select(x => CreateScopeViewModel(x, true)).ToList(), + }; + + var apiScopes = new List(); + foreach(var parsedScope in request.ValidatedResources.ParsedScopes) + { + var apiScope = request.ValidatedResources.Resources.FindApiScope(parsedScope.ParsedName); + if (apiScope != null) + { + var scopeVm = CreateScopeViewModel(parsedScope, apiScope, true); + apiScopes.Add(scopeVm); + } + } + + if (resources.OfflineAccess) + { + apiScopes.Add(GetOfflineAccessScope(true)); + } + + ConsentInput.ApiScopes = apiScopes; + return Page(); } @@ -65,137 +109,56 @@ namespace Volo.Abp.Account.Web.Pages throw new ApplicationException("Unknown Error!"); } - protected virtual async Task ProcessConsentAsync() + protected virtual async Task ProcessConsentAsync() { - var result = new ProcessConsentResult(); + var result = new ConsentModel.ProcessConsentResult(); - // validate return url is still valid - var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); - if (request == null) - { - return result; - } - - ConsentResponse grantedConsent = null; + ConsentResponse grantedConsent; - // user clicked 'no' - send back the standard 'access_denied' response - if (Consent?.Button == "no") + if (ConsentInput.UserDecision == "no") { - grantedConsent = new ConsentResponse { Error = AuthorizationError.AccessDenied }; - // emit event - //await _events.RaiseAsync(new ConsentDeniedEvent(User.GetSubjectId(), request.Client.ClientId, request.ValidatedResources.RawScopeValues)); + grantedConsent = new ConsentResponse + { + Error = AuthorizationError.AccessDenied + }; } - // user clicked 'yes' - validate the data - else if (Consent?.Button == "yes") + else { - Consent.ScopesConsented = - Consent.ApiScopes.Union(Consent.IdentityScopes).Distinct().Select(x => x.Value).ToList(); - // if the user consented to some scope, build the response model - if (!Consent.ScopesConsented.IsNullOrEmpty()) + if (!ConsentInput.IdentityScopes.IsNullOrEmpty() || !ConsentInput.ApiScopes.IsNullOrEmpty()) { - var scopes = Consent.ScopesConsented; - if (ConsentOptions.EnableOfflineAccess == false) - { - scopes = scopes.Where(x => x != IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess).ToList(); - } - grantedConsent = new ConsentResponse { - RememberConsent = Consent.RememberConsent, - ScopesValuesConsented = scopes.ToArray(), - Description = Consent.Description + RememberConsent = ConsentInput.RememberConsent, + ScopesValuesConsented = ConsentInput.GetAllowedScopeNames() }; - - // emit event - //await _events.RaiseAsync(new ConsentGrantedEvent(User.GetSubjectId(), request.Client.ClientId, request.ValidatedResources.RawScopeValues, grantedConsent.ScopesValuesConsented, grantedConsent.RememberConsent)); } else { - //throw new UserFriendlyException("You must pick at least one permission"); //TODO: How to handle this - result.ValidationError = ConsentOptions.MustChooseOneErrorMessage; + throw new UserFriendlyException("You must pick at least one permission"); //TODO: How to handle this } } - else - { - result.ValidationError = ConsentOptions.InvalidSelectionErrorMessage; - } if (grantedConsent != null) { - // communicate outcome of consent back to identityserver - await _interaction.GrantConsentAsync(request, grantedConsent); - - // indicate that's it ok to redirect back to authorization endpoint - result.RedirectUri = ReturnUrl; //TODO: ReturnUrlHash? - result.Client = request.Client; - } - else - { - // we need to redisplay the consent UI - - result.ViewModel = await BuildViewModelAsync(ReturnUrl, Consent); - } - - return result; - } - - private async Task BuildViewModelAsync(string returnUrl, ConsentInputModel model = null) - { - var request = await _interaction.GetAuthorizationContextAsync(returnUrl); - if (request != null) - { - return CreateConsentViewModel(model, returnUrl, request); - } - - throw new ApplicationException($"No consent request matching request: {returnUrl}"); - } - - private ConsentViewModel CreateConsentViewModel(ConsentInputModel model, string returnUrl, AuthorizationRequest request) - { - var consentViewModel = new ConsentViewModel - { - RememberConsent = model?.RememberConsent ?? true, - ScopesConsented = model?.ScopesConsented ?? new List(), - Description = model?.Description, - - ClientName = request.Client.ClientName ?? request.Client.ClientId, - ClientUrl = request.Client.ClientUri, - ClientLogoUrl = request.Client.LogoUri, - AllowRememberConsent = request.Client.AllowRememberConsent - }; - - consentViewModel.IdentityScopes = request.ValidatedResources.Resources.IdentityResources.Select(x => - CreateScopeViewModel(x, consentViewModel.ScopesConsented.Contains(x.Name) || model == null)) - .ToList(); - - var apiScopes = new List(); - foreach(var parsedScope in request.ValidatedResources.ParsedScopes) - { - var apiScope = request.ValidatedResources.Resources.FindApiScope(parsedScope.ParsedName); - if (apiScope != null) + var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); + if (request == null) { - var scopeVm = CreateScopeViewModel(parsedScope, apiScope, - consentViewModel.ScopesConsented.Contains(parsedScope.RawValue) || model == null); - apiScopes.Add(scopeVm); + return result; } - } - if (ConsentOptions.EnableOfflineAccess && request.ValidatedResources.Resources.OfflineAccess) - { - apiScopes.Add(GetOfflineAccessScope(consentViewModel.ScopesConsented.Contains(IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); - } + await _interaction.GrantConsentAsync(request, grantedConsent); - consentViewModel.ApiScopes = apiScopes; + result.RedirectUri = ReturnUrl; //TODO: ReturnUrlHash? + } - return consentViewModel; + return result; } - - protected virtual ScopeViewModel CreateScopeViewModel(IdentityResource identity, bool check) + protected virtual ConsentModel.ScopeViewModel CreateScopeViewModel(IdentityResource identity, bool check) { - return new ScopeViewModel + return new ConsentModel.ScopeViewModel { - Value = identity.Name, + Name = identity.Name, DisplayName = identity.DisplayName, Description = identity.Description, Emphasize = identity.Emphasize, @@ -204,7 +167,7 @@ namespace Volo.Abp.Account.Web.Pages }; } - protected virtual ScopeViewModel CreateScopeViewModel(ParsedScopeValue parsedScopeValue, ApiScope apiScope, bool check) + protected virtual ConsentModel.ScopeViewModel CreateScopeViewModel(ParsedScopeValue parsedScopeValue, ApiScope apiScope, bool check) { var displayName = apiScope.DisplayName ?? apiScope.Name; if (!string.IsNullOrWhiteSpace(parsedScopeValue.ParsedParameter)) @@ -214,7 +177,7 @@ namespace Volo.Abp.Account.Web.Pages return new ScopeViewModel { - Value = parsedScopeValue.RawValue, + Name = parsedScopeValue.RawValue, DisplayName = displayName, Description = apiScope.Description, Emphasize = apiScope.Emphasize, @@ -223,11 +186,11 @@ namespace Volo.Abp.Account.Web.Pages }; } - protected virtual ScopeViewModel GetOfflineAccessScope(bool check) + protected virtual ConsentModel.ScopeViewModel GetOfflineAccessScope(bool check) { - return new ScopeViewModel + return new ConsentModel.ScopeViewModel { - Value = IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess, + Name = IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess, DisplayName = "Offline Access", //TODO: Localize Description = "Access to your applications and resources, even when you are offline", Emphasize = true, @@ -237,36 +200,28 @@ namespace Volo.Abp.Account.Web.Pages public class ConsentInputModel { - [Required] - public string Button { get; set; } + public List IdentityScopes { get; set; } - public List ScopesConsented { get; set; } + public List ApiScopes { get; set; } - public bool RememberConsent { get; set; } - - public string Description { get; set; } - } - - - public class ConsentViewModel : ConsentInputModel - { - public string ClientName { get; set; } - public string ClientUrl { get; set; } - - public string ClientLogoUrl { get; set; } - - public bool AllowRememberConsent { get; set; } + [Required] + public string UserDecision { get; set; } - public List IdentityScopes { get; set; } + public bool RememberConsent { get; set; } - public List ApiScopes { get; set; } + public List GetAllowedScopeNames() + { + var identityScopes = IdentityScopes ?? new List(); + var apiScopes = ApiScopes ?? new List(); + return identityScopes.Union(apiScopes).Where(s => s.Checked).Select(s => s.Name).ToList(); + } } public class ScopeViewModel { [Required] [HiddenInput] - public string Value { get; set; } + public string Name { get; set; } public bool Checked { get; set; } @@ -283,13 +238,29 @@ namespace Volo.Abp.Account.Web.Pages { public bool IsRedirect => RedirectUri != null; public string RedirectUri { get; set; } - public Client Client { get; set; } - - public bool ShowView => ViewModel != null; - public ConsentViewModel ViewModel { get; set; } public bool HasValidationError => ValidationError != null; public string ValidationError { get; set; } } + + public class ClientInfoModel + { + public string ClientName { get; set; } + + public string ClientUrl { get; set; } + + public string ClientLogoUrl { get; set; } + + public bool AllowRememberConsent { get; set; } + + public ClientInfoModel(Client client) + { + //TODO: Automap + ClientName = client.ClientId; + ClientUrl = client.ClientUri; + ClientLogoUrl = client.LogoUri; + AllowRememberConsent = client.AllowRememberConsent; + } + } } } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml index 0e7b14236a..fdea548c76 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml @@ -3,8 +3,12 @@ @using Volo.Abp.Account.Localization @using Microsoft.AspNetCore.Mvc.Localization @using Volo.Abp.Account.Web.Pages.Account +@using Volo.Abp.AspNetCore.Mvc.UI.Theming +@inject IThemeManager ThemeManager @inject IHtmlLocalizer L - +@{ + Layout = ThemeManager.CurrentTheme.GetApplicationLayout(); +} @section scripts { From 1fa69f0c9f69c20b736c28ec2c2e6b9c10e18da0 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 7 Jul 2020 14:47:16 +0800 Subject: [PATCH 14/32] Update IdentityServerDbContext. --- ...piResourceSecretConsts.cs => SecretConsts.cs} | 6 ++---- .../IIdentityServerDbContext.cs | 3 +++ .../IdentityServerDbContext.cs | 3 +++ ...tityServerDbContextModelCreatingExtensions.cs | 16 ++++++++-------- 4 files changed, 16 insertions(+), 12 deletions(-) rename modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/{ApiResources/ApiResourceSecretConsts.cs => SecretConsts.cs} (72%) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs similarity index 72% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs index f2692d1653..f3b7f2c5df 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs @@ -1,6 +1,6 @@ -namespace Volo.Abp.IdentityServer.ApiResources +namespace Volo.Abp.IdentityServer { - public class ApiResourceSecretConsts + public class SecretConsts { /// /// Default value: 250 @@ -12,8 +12,6 @@ /// public static int ValueMaxLength { get; set; } = 4000; - public static int ValueMaxLengthValue { get; set; } = ValueMaxLength; - /// /// Default value: 1000 /// diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs index 3178fa02f2..75343419a8 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; @@ -22,6 +23,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore DbSet ApiResourceScopes { get; set; } + DbSet ApiResourceProperties { get; set; } + #endregion #region ApiScope diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs index c8dc32b183..9bff7f13a1 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; @@ -22,6 +23,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore public DbSet ApiResourceScopes { get; set; } + public DbSet ApiResourceProperties { get; set; } + #endregion #region ApiScope diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index b2dba48e15..25a0d7605f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -128,16 +128,16 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.ClientId, x.Type, x.Value}); - b.Property(x => x.Type).HasMaxLength(ApiResourceSecretConsts.TypeMaxLength).IsRequired(); + b.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { - ApiResourceSecretConsts.ValueMaxLengthValue = 300; + SecretConsts.ValueMaxLengthValue = 300; } - b.Property(x => x.Value).HasMaxLength(ApiResourceSecretConsts.ValueMaxLengthValue).IsRequired(); + b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLengthValue).IsRequired(); - b.Property(x => x.Description).HasMaxLength(ApiResourceSecretConsts.DescriptionMaxLength); + b.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); }); builder.Entity(b => @@ -263,15 +263,15 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.ApiResourceId, x.Type, x.Value}); - b.Property(x => x.Type).HasMaxLength(ApiResourceSecretConsts.TypeMaxLength).IsRequired(); + b.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { - ApiResourceSecretConsts.ValueMaxLengthValue = 300; + SecretConsts.ValueMaxLengthValue = 300; } - b.Property(x => x.Value).HasMaxLength(ApiResourceSecretConsts.ValueMaxLengthValue).IsRequired(); + b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLengthValue).IsRequired(); - b.Property(x => x.Description).HasMaxLength(ApiResourceSecretConsts.DescriptionMaxLength); + b.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); }); builder.Entity(b => From 43181eef5748929b7502642606b725b539793169 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 7 Jul 2020 14:48:10 +0800 Subject: [PATCH 15/32] Update IdentityServerDbContextModelCreatingExtensions. --- .../IdentityServerDbContextModelCreatingExtensions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index 25a0d7605f..e78ac0bc95 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -132,10 +132,10 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { - SecretConsts.ValueMaxLengthValue = 300; + SecretConsts.ValueMaxLength = 300; } - b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLengthValue).IsRequired(); + b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLength).IsRequired(); b.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); }); @@ -267,9 +267,9 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { - SecretConsts.ValueMaxLengthValue = 300; + SecretConsts.ValueMaxLength = 300; } - b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLengthValue).IsRequired(); + b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLength).IsRequired(); b.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); }); From cee969f7bb80f61a3f85b7a51a347ca951635677 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 7 Jul 2020 16:07:20 +0800 Subject: [PATCH 16/32] Recreate Template projects migrations. --- .../ApiResources/ApiResourceConsts.cs | 6 +- .../ApiResourceSecretConsts.cs} | 4 +- .../IdentityServer/Clients/ClientConsts.cs | 2 + .../Clients/ClientSecretConsts.cs | 20 ++ .../IdentityServer/Clients/ClientProperty.cs | 4 +- ...yServerDbContextModelCreatingExtensions.cs | 29 +- ....cs => 20200707075540_Initial.Designer.cs} | 24 +- ...0_Initial.cs => 20200707075540_Initial.cs} | 14 +- ...ectNameMigrationsDbContextModelSnapshot.cs | 22 +- ....cs => 20200707075532_Initial.Designer.cs} | 294 ++++++++++++++---- ...1_Initial.cs => 20200707075532_Initial.cs} | 217 ++++++++++--- ...verHostMigrationsDbContextModelSnapshot.cs | 292 +++++++++++++---- ....cs => 20200707075539_Initial.Designer.cs} | 2 +- ...0_Initial.cs => 20200707075539_Initial.cs} | 0 14 files changed, 706 insertions(+), 224 deletions(-) rename modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/{SecretConsts.cs => ApiResources/ApiResourceSecretConsts.cs} (82%) create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientSecretConsts.cs rename templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/{20200707050900_Initial.Designer.cs => 20200707075540_Initial.Designer.cs} (99%) rename templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/{20200707050900_Initial.cs => 20200707075540_Initial.cs} (99%) rename templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/{20200624023331_Initial.Designer.cs => 20200707075532_Initial.Designer.cs} (89%) rename templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/{20200624023331_Initial.cs => 20200707075532_Initial.cs} (87%) rename templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/{20200624023340_Initial.Designer.cs => 20200707075539_Initial.Designer.cs} (99%) rename templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/{20200624023340_Initial.cs => 20200707075539_Initial.cs} (100%) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceConsts.cs index 9a023c435b..05719fbc8f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceConsts.cs @@ -4,8 +4,10 @@ { public static int NameMaxLength { get; set; } = 200; - public static int DisplayNameMaxLength { get; set; } = 200; + public static int DisplayNameMaxLength { get; set; } = 200; - public static int DescriptionMaxLength { get; set; } = 1000; + public static int DescriptionMaxLength { get; set; } = 1000; + + public static int AllowedAccessTokenSigningAlgorithmsMaxLength { get; set; } = 100; } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs similarity index 82% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs index f3b7f2c5df..523bc147b1 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecretConsts.cs @@ -1,6 +1,6 @@ -namespace Volo.Abp.IdentityServer +namespace Volo.Abp.IdentityServer.ApiResources { - public class SecretConsts + public class ApiResourceSecretConsts { /// /// Default value: 250 diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientConsts.cs index 4331ab7064..e76411d0ed 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientConsts.cs @@ -23,5 +23,7 @@ public static int PairWiseSubjectSaltMaxLength { get; set; } = 200; public static int UserCodeTypeMaxLength { get; set; } = 100; + + public static int AllowedIdentityTokenSigningAlgorithms { get; set; } = 100; } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientSecretConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientSecretConsts.cs new file mode 100644 index 0000000000..60eb0807d1 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientSecretConsts.cs @@ -0,0 +1,20 @@ +namespace Volo.Abp.IdentityServer.Clients +{ + public class ClientSecretConsts + { + /// + /// Default value: 250 + /// + public static int TypeMaxLength { get; set; } = 250; + + /// + /// Default value: 4000 + /// + public static int ValueMaxLength { get; set; } = 4000; + + /// + /// Default value: 2000 + /// + public static int DescriptionMaxLength { get; set; } = 2000; + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientProperty.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientProperty.cs index daddd94e83..7347f1cc7c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientProperty.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientProperty.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.IdentityServer.Clients } - public virtual bool Equals(Guid clientId, [NotNull] string key, string value) + public virtual bool Equals(Guid clientId, [NotNull] string key, [NotNull] string value) { return ClientId == clientId && Key == key && Value == value; } @@ -36,4 +36,4 @@ namespace Volo.Abp.IdentityServer.Clients return new object[] { ClientId, Key }; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index e78ac0bc95..20a99c082e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -50,6 +50,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.ClientClaimsPrefix).HasMaxLength(ClientConsts.ClientClaimsPrefixMaxLength); b.Property(x => x.PairWiseSubjectSalt).HasMaxLength(ClientConsts.PairWiseSubjectSaltMaxLength); b.Property(x => x.UserCodeType).HasMaxLength(ClientConsts.UserCodeTypeMaxLength); + b.Property(x => x.AllowedIdentityTokenSigningAlgorithms).HasMaxLength(ClientConsts.AllowedIdentityTokenSigningAlgorithms); b.HasMany(x => x.AllowedScopes).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); b.HasMany(x => x.ClientSecrets).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); @@ -128,16 +129,13 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.ClientId, x.Type, x.Value}); - b.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired(); - + b.Property(x => x.Type).HasMaxLength(ClientSecretConsts.TypeMaxLength).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { - SecretConsts.ValueMaxLength = 300; + ClientSecretConsts.ValueMaxLength = 300; } - - b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLength).IsRequired(); - - b.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); + b.Property(x => x.Value).HasMaxLength(ClientSecretConsts.ValueMaxLength).IsRequired(); + b.Property(x => x.Description).HasMaxLength(ClientSecretConsts.DescriptionMaxLength); }); builder.Entity(b => @@ -180,7 +178,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.ConfigureByConvention(); - b.HasKey(x => new {x.ClientId, x.Key}); + b.HasKey(x => new {x.ClientId, x.Key, x.Value}); b.Property(x => x.Key).HasMaxLength(ClientPropertyConsts.KeyMaxLength).IsRequired(); b.Property(x => x.Value).HasMaxLength(ClientPropertyConsts.ValueMaxLength).IsRequired(); @@ -223,7 +221,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.ConfigureByConvention(); - b.HasKey(x => new {x.IdentityResourceId, x.Key}); + b.HasKey(x => new {x.IdentityResourceId, x.Key, x.Value}); b.Property(x => x.Key).HasMaxLength(IdentityResourcePropertyConsts.KeyMaxLength).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) @@ -248,6 +246,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.Property(x => x.Name).HasMaxLength(ApiResourceConsts.NameMaxLength).IsRequired(); b.Property(x => x.DisplayName).HasMaxLength(ApiResourceConsts.DisplayNameMaxLength); b.Property(x => x.Description).HasMaxLength(ApiResourceConsts.DescriptionMaxLength); + b.Property(x => x.AllowedAccessTokenSigningAlgorithms).HasMaxLength(ApiResourceConsts.AllowedAccessTokenSigningAlgorithmsMaxLength); b.HasMany(x => x.Secrets).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); b.HasMany(x => x.Scopes).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); @@ -263,15 +262,15 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.HasKey(x => new {x.ApiResourceId, x.Type, x.Value}); - b.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired(); + b.Property(x => x.Type).HasMaxLength(ApiResourceSecretConsts.TypeMaxLength).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) { - SecretConsts.ValueMaxLength = 300; + ApiResourceSecretConsts.ValueMaxLength = 300; } - b.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLength).IsRequired(); + b.Property(x => x.Value).HasMaxLength(ApiResourceSecretConsts.ValueMaxLength).IsRequired(); - b.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); + b.Property(x => x.Description).HasMaxLength(ApiResourceSecretConsts.DescriptionMaxLength); }); builder.Entity(b => @@ -302,7 +301,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.ConfigureByConvention(); - b.HasKey(x => new {x.ApiResourceId, x.Key}); + b.HasKey(x => new {x.ApiResourceId, x.Key, x.Value}); b.Property(x => x.Key).HasMaxLength(ApiResourcePropertyConsts.KeyMaxLength).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) @@ -349,7 +348,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore b.ConfigureByConvention(); - b.HasKey(x => new {x.ApiScopeId, x.Key}); + b.HasKey(x => new {x.ApiScopeId, x.Key, x.Value}); b.Property(x => x.Key).HasMaxLength(ApiScopePropertyConsts.KeyMaxLength).IsRequired(); if (IsDatabaseProvider(builder, options, EfCoreDatabaseProvider.MySql, EfCoreDatabaseProvider.Oracle)) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.Designer.cs similarity index 99% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.Designer.cs index ee4de4f358..fadec16eaf 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.Designer.cs @@ -11,7 +11,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameMigrationsDbContext))] - [Migration("20200707050900_Initial")] + [Migration("20200707075540_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -873,11 +873,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.HasKey("ApiResourceId", "Key"); + b.HasKey("ApiResourceId", "Key", "Value"); b.ToTable("IdentityServerApiResourceProperties"); }); @@ -889,7 +888,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AllowedAccessTokenSigningAlgorithms") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("ConcurrencyStamp") .IsConcurrencyToken() @@ -1114,11 +1114,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.HasKey("ApiScopeId", "Key"); + b.HasKey("ApiScopeId", "Key", "Value"); b.ToTable("IdentityServerApiScopeProperties"); }); @@ -1151,7 +1150,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("AllowedIdentityTokenSigningAlgorithms") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("bit"); @@ -1390,11 +1390,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.HasKey("ClientId", "Key"); + b.HasKey("ClientId", "Key", "Value"); b.ToTable("IdentityServerClientProperties"); }); @@ -1441,8 +1440,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1693,11 +1692,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.HasKey("IdentityResourceId", "Key"); + b.HasKey("IdentityResourceId", "Key", "Value"); b.ToTable("IdentityServerIdentityResourceProperties"); }); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.cs similarity index 99% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.cs index 48726d777b..669982f451 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707050900_Initial.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.cs @@ -249,7 +249,7 @@ namespace MyCompanyName.MyProjectName.Migrations DisplayName = table.Column(maxLength: 200, nullable: true), Description = table.Column(maxLength: 1000, nullable: true), Enabled = table.Column(nullable: false), - AllowedAccessTokenSigningAlgorithms = table.Column(nullable: true), + AllowedAccessTokenSigningAlgorithms = table.Column(maxLength: 100, nullable: true), ShowInDiscoveryDocument = table.Column(nullable: false) }, constraints: table => @@ -319,7 +319,7 @@ namespace MyCompanyName.MyProjectName.Migrations BackChannelLogoutSessionRequired = table.Column(nullable: false), AllowOfflineAccess = table.Column(nullable: false), IdentityTokenLifetime = table.Column(nullable: false), - AllowedIdentityTokenSigningAlgorithms = table.Column(nullable: true), + AllowedIdentityTokenSigningAlgorithms = table.Column(maxLength: 100, nullable: true), AccessTokenLifetime = table.Column(nullable: false), AuthorizationCodeLifetime = table.Column(nullable: false), ConsentLifetime = table.Column(nullable: true), @@ -676,7 +676,7 @@ namespace MyCompanyName.MyProjectName.Migrations }, constraints: table => { - table.PrimaryKey("PK_IdentityServerApiResourceProperties", x => new { x.ApiResourceId, x.Key }); + table.PrimaryKey("PK_IdentityServerApiResourceProperties", x => new { x.ApiResourceId, x.Key, x.Value }); table.ForeignKey( name: "FK_IdentityServerApiResourceProperties_IdentityServerApiResources_ApiResourceId", column: x => x.ApiResourceId, @@ -752,7 +752,7 @@ namespace MyCompanyName.MyProjectName.Migrations }, constraints: table => { - table.PrimaryKey("PK_IdentityServerApiScopeProperties", x => new { x.ApiScopeId, x.Key }); + table.PrimaryKey("PK_IdentityServerApiScopeProperties", x => new { x.ApiScopeId, x.Key, x.Value }); table.ForeignKey( name: "FK_IdentityServerApiScopeProperties_IdentityServerApiScopes_ApiScopeId", column: x => x.ApiScopeId, @@ -862,7 +862,7 @@ namespace MyCompanyName.MyProjectName.Migrations }, constraints: table => { - table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key }); + table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key, x.Value }); table.ForeignKey( name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", column: x => x.ClientId, @@ -914,7 +914,7 @@ namespace MyCompanyName.MyProjectName.Migrations Type = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 4000, nullable: false), ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 1000, nullable: true), + Description = table.Column(maxLength: 2000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -956,7 +956,7 @@ namespace MyCompanyName.MyProjectName.Migrations }, constraints: table => { - table.PrimaryKey("PK_IdentityServerIdentityResourceProperties", x => new { x.IdentityResourceId, x.Key }); + table.PrimaryKey("PK_IdentityServerIdentityResourceProperties", x => new { x.IdentityResourceId, x.Key, x.Value }); table.ForeignKey( name: "FK_IdentityServerIdentityResourceProperties_IdentityServerIdentityResources_IdentityResourceId", column: x => x.IdentityResourceId, diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs index bfcb19749d..e3bb89da7d 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs @@ -871,11 +871,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.HasKey("ApiResourceId", "Key"); + b.HasKey("ApiResourceId", "Key", "Value"); b.ToTable("IdentityServerApiResourceProperties"); }); @@ -887,7 +886,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AllowedAccessTokenSigningAlgorithms") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("ConcurrencyStamp") .IsConcurrencyToken() @@ -1112,11 +1112,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.HasKey("ApiScopeId", "Key"); + b.HasKey("ApiScopeId", "Key", "Value"); b.ToTable("IdentityServerApiScopeProperties"); }); @@ -1149,7 +1148,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("AllowedIdentityTokenSigningAlgorithms") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); b.Property("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("bit"); @@ -1388,11 +1388,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.HasKey("ClientId", "Key"); + b.HasKey("ClientId", "Key", "Value"); b.ToTable("IdentityServerClientProperties"); }); @@ -1439,8 +1438,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1691,11 +1690,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.HasKey("IdentityResourceId", "Key"); + b.HasKey("IdentityResourceId", "Key", "Value"); b.ToTable("IdentityServerIdentityResourceProperties"); }); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200624023331_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.Designer.cs similarity index 89% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200624023331_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.Designer.cs index 23c25b58cd..59e4e386ff 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200624023331_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.Designer.cs @@ -11,7 +11,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(IdentityServerHostMigrationsDbContext))] - [Migration("20200624023331_Initial")] + [Migration("20200707075532_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -774,12 +774,34 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpOrganizationUnitRoles"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResource", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnName("ConcurrencyStamp") @@ -836,15 +858,18 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties") - .HasColumnType("nvarchar(max)"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); + b.HasIndex("Name") + .IsUnique(); + b.ToTable("IdentityServerApiResources"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -855,18 +880,76 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Type"); - b.ToTable("IdentityServerApiClaims"); + b.ToTable("IdentityServerApiResourceClaims"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); - b.Property("Name") + b.Property("Scope") .HasColumnType("nvarchar(200)") .HasMaxLength(200); + b.HasKey("ApiResourceId", "Scope"); + + b.ToTable("IdentityServerApiResourceScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiResourceSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(40)") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + b.Property("Description") .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); @@ -878,58 +961,76 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Emphasize") .HasColumnType("bit"); + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + b.Property("Required") .HasColumnType("bit"); b.Property("ShowInDiscoveryDocument") .HasColumnType("bit"); - b.HasKey("ApiResourceId", "Name"); + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); b.ToTable("IdentityServerApiScopes"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => { - b.Property("ApiResourceId") + b.Property("ApiScopeId") .HasColumnType("uniqueidentifier"); - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - b.Property("Type") .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.HasKey("ApiResourceId", "Name", "Type"); + b.HasKey("ApiScopeId", "Type"); b.ToTable("IdentityServerApiScopeClaims"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => { - b.Property("ApiResourceId") + b.Property("ApiScopeId") .HasColumnType("uniqueidentifier"); - b.Property("Type") + b.Property("Key") .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("Description") .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.Property("Expiration") - .HasColumnType("datetime2"); + b.HasKey("ApiScopeId", "Key", "Value"); - b.HasKey("ApiResourceId", "Type", "Value"); - - b.ToTable("IdentityServerApiSecrets"); + b.ToTable("IdentityServerApiScopeProperties"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => @@ -959,6 +1060,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("AllowRememberConsent") .HasColumnType("bit"); + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + b.Property("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("bit"); @@ -1089,6 +1194,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("RequirePkce") .HasColumnType("bit"); + b.Property("RequireRequestObject") + .HasColumnType("bit"); + b.Property("SlidingRefreshTokenLifetime") .HasColumnType("int"); @@ -1193,11 +1301,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.HasKey("ClientId", "Key"); + b.HasKey("ClientId", "Key", "Value"); b.ToTable("IdentityServerClientProperties"); }); @@ -1285,6 +1392,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(max)") .HasMaxLength(50000); + b.Property("Description") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + b.Property("DeviceCode") .IsRequired() .HasColumnType("nvarchar(200)") @@ -1298,6 +1409,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("ExtraProperties") .HasColumnType("nvarchar(max)"); + b.Property("SessionId") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + b.Property("SubjectId") .HasColumnType("nvarchar(200)") .HasMaxLength(200); @@ -1314,8 +1429,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Expiration"); - b.HasIndex("UserCode") - .IsUnique(); + b.HasIndex("UserCode"); b.ToTable("IdentityServerDeviceFlowCodes"); }); @@ -1337,6 +1451,9 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(40)") .HasMaxLength(40); + b.Property("ConsumedTime") + .HasColumnType("datetime2"); + b.Property("CreationTime") .HasColumnType("datetime2"); @@ -1345,6 +1462,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(max)") .HasMaxLength(50000); + b.Property("Description") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + b.Property("Expiration") .HasColumnType("datetime2"); @@ -1355,6 +1476,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("SessionId") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + b.Property("SubjectId") .HasColumnType("nvarchar(200)") .HasMaxLength(200); @@ -1370,21 +1495,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "ClientId", "Type"); - b.ToTable("IdentityServerPersistedGrants"); - }); + b.HasIndex("SubjectId", "SessionId", "Type"); - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => - { - b.Property("IdentityResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("IdentityResourceId", "Type"); - - b.ToTable("IdentityServerIdentityClaims"); + b.ToTable("IdentityServerPersistedGrants"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => @@ -1452,9 +1565,6 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - b.Property("Required") .HasColumnType("bit"); @@ -1463,9 +1573,44 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); + b.HasIndex("Name") + .IsUnique(); + b.ToTable("IdentityServerIdentityResources"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityResourceClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("IdentityResourceId", "Key", "Value"); + + b.ToTable("IdentityServerIdentityResourceProperties"); + }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") @@ -1721,38 +1866,56 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + .WithMany("Properties") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + .WithMany("Secrets") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) .WithMany("UserClaims") - .HasForeignKey("ApiResourceId", "Name") + .HasForeignKey("ApiScopeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Secrets") - .HasForeignKey("ApiResourceId") + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("Properties") + .HasForeignKey("ApiScopeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); @@ -1838,7 +2001,7 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => { b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) .WithMany("UserClaims") @@ -1847,6 +2010,15 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("Properties") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { b.HasOne("Volo.Abp.TenantManagement.Tenant", null) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200624023331_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.cs similarity index 87% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200624023331_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.cs index 9287186f86..2ee3b628fb 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200624023331_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.cs @@ -213,13 +213,41 @@ namespace MyCompanyName.MyProjectName.Migrations DisplayName = table.Column(maxLength: 200, nullable: true), Description = table.Column(maxLength: 1000, nullable: true), Enabled = table.Column(nullable: false), - Properties = table.Column(nullable: true) + AllowedAccessTokenSigningAlgorithms = table.Column(maxLength: 100, nullable: true), + ShowInDiscoveryDocument = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); }); + migrationBuilder.CreateTable( + name: "IdentityServerApiScopes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + Enabled = table.Column(nullable: false), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), + Required = table.Column(nullable: false), + Emphasize = table.Column(nullable: false), + ShowInDiscoveryDocument = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiScopes", x => x.Id); + }); + migrationBuilder.CreateTable( name: "IdentityServerClients", columns: table => new @@ -247,6 +275,7 @@ namespace MyCompanyName.MyProjectName.Migrations AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), RequirePkce = table.Column(nullable: false), AllowPlainTextPkce = table.Column(nullable: false), + RequireRequestObject = table.Column(nullable: false), AllowAccessTokensViaBrowser = table.Column(nullable: false), FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), FrontChannelLogoutSessionRequired = table.Column(nullable: false), @@ -254,6 +283,7 @@ namespace MyCompanyName.MyProjectName.Migrations BackChannelLogoutSessionRequired = table.Column(nullable: false), AllowOfflineAccess = table.Column(nullable: false), IdentityTokenLifetime = table.Column(nullable: false), + AllowedIdentityTokenSigningAlgorithms = table.Column(maxLength: 100, nullable: true), AccessTokenLifetime = table.Column(nullable: false), AuthorizationCodeLifetime = table.Column(nullable: false), ConsentLifetime = table.Column(nullable: true), @@ -289,7 +319,9 @@ namespace MyCompanyName.MyProjectName.Migrations DeviceCode = table.Column(maxLength: 200, nullable: false), UserCode = table.Column(maxLength: 200, nullable: false), SubjectId = table.Column(maxLength: 200, nullable: true), + SessionId = table.Column(maxLength: 100, nullable: true), ClientId = table.Column(maxLength: 200, nullable: false), + Description = table.Column(maxLength: 200, nullable: true), Expiration = table.Column(nullable: false), Data = table.Column(maxLength: 50000, nullable: false) }, @@ -318,8 +350,7 @@ namespace MyCompanyName.MyProjectName.Migrations Enabled = table.Column(nullable: false), Required = table.Column(nullable: false), Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false), - Properties = table.Column(nullable: true) + ShowInDiscoveryDocument = table.Column(nullable: false) }, constraints: table => { @@ -336,9 +367,12 @@ namespace MyCompanyName.MyProjectName.Migrations ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), Type = table.Column(maxLength: 50, nullable: false), SubjectId = table.Column(maxLength: 200, nullable: true), + SessionId = table.Column(maxLength: 100, nullable: true), ClientId = table.Column(maxLength: 200, nullable: false), + Description = table.Column(maxLength: 200, nullable: true), CreationTime = table.Column(nullable: false), Expiration = table.Column(nullable: true), + ConsumedTime = table.Column(nullable: true), Data = table.Column(maxLength: 50000, nullable: false) }, constraints: table => @@ -579,7 +613,7 @@ namespace MyCompanyName.MyProjectName.Migrations }); migrationBuilder.CreateTable( - name: "IdentityServerApiClaims", + name: "IdentityServerApiResourceClaims", columns: table => new { Type = table.Column(maxLength: 200, nullable: false), @@ -587,9 +621,9 @@ namespace MyCompanyName.MyProjectName.Migrations }, constraints: table => { - table.PrimaryKey("PK_IdentityServerApiClaims", x => new { x.ApiResourceId, x.Type }); + table.PrimaryKey("PK_IdentityServerApiResourceClaims", x => new { x.ApiResourceId, x.Type }); table.ForeignKey( - name: "FK_IdentityServerApiClaims_IdentityServerApiResources_ApiResourceId", + name: "FK_IdentityServerApiResourceClaims_IdentityServerApiResources_ApiResourceId", column: x => x.ApiResourceId, principalTable: "IdentityServerApiResources", principalColumn: "Id", @@ -597,22 +631,36 @@ namespace MyCompanyName.MyProjectName.Migrations }); migrationBuilder.CreateTable( - name: "IdentityServerApiScopes", + name: "IdentityServerApiResourceProperties", columns: table => new { ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false) + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiResourceProperties", x => new { x.ApiResourceId, x.Key, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerApiResourceProperties_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiResourceScopes", + columns: table => new + { + ApiResourceId = table.Column(nullable: false), + Scope = table.Column(maxLength: 200, nullable: false) }, constraints: table => { - table.PrimaryKey("PK_IdentityServerApiScopes", x => new { x.ApiResourceId, x.Name }); + table.PrimaryKey("PK_IdentityServerApiResourceScopes", x => new { x.ApiResourceId, x.Scope }); table.ForeignKey( - name: "FK_IdentityServerApiScopes_IdentityServerApiResources_ApiResourceId", + name: "FK_IdentityServerApiResourceScopes_IdentityServerApiResources_ApiResourceId", column: x => x.ApiResourceId, principalTable: "IdentityServerApiResources", principalColumn: "Id", @@ -620,26 +668,63 @@ namespace MyCompanyName.MyProjectName.Migrations }); migrationBuilder.CreateTable( - name: "IdentityServerApiSecrets", + name: "IdentityServerApiResourceSecrets", columns: table => new { Type = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 4000, nullable: false), ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => { - table.PrimaryKey("PK_IdentityServerApiSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); + table.PrimaryKey("PK_IdentityServerApiResourceSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); table.ForeignKey( - name: "FK_IdentityServerApiSecrets_IdentityServerApiResources_ApiResourceId", + name: "FK_IdentityServerApiResourceSecrets_IdentityServerApiResources_ApiResourceId", column: x => x.ApiResourceId, principalTable: "IdentityServerApiResources", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "IdentityServerApiScopeClaims", + columns: table => new + { + Type = table.Column(maxLength: 200, nullable: false), + ApiScopeId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiScopeId, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiScopeId", + column: x => x.ApiScopeId, + principalTable: "IdentityServerApiScopes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiScopeProperties", + columns: table => new + { + ApiScopeId = table.Column(nullable: false), + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiScopeProperties", x => new { x.ApiScopeId, x.Key, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerApiScopeProperties_IdentityServerApiScopes_ApiScopeId", + column: x => x.ApiScopeId, + principalTable: "IdentityServerApiScopes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "IdentityServerClientClaims", columns: table => new @@ -741,7 +826,7 @@ namespace MyCompanyName.MyProjectName.Migrations }, constraints: table => { - table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key }); + table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key, x.Value }); table.ForeignKey( name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", column: x => x.ClientId, @@ -808,7 +893,7 @@ namespace MyCompanyName.MyProjectName.Migrations }); migrationBuilder.CreateTable( - name: "IdentityServerIdentityClaims", + name: "IdentityServerIdentityResourceClaims", columns: table => new { Type = table.Column(maxLength: 200, nullable: false), @@ -816,9 +901,28 @@ namespace MyCompanyName.MyProjectName.Migrations }, constraints: table => { - table.PrimaryKey("PK_IdentityServerIdentityClaims", x => new { x.IdentityResourceId, x.Type }); + table.PrimaryKey("PK_IdentityServerIdentityResourceClaims", x => new { x.IdentityResourceId, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerIdentityResourceClaims_IdentityServerIdentityResources_IdentityResourceId", + column: x => x.IdentityResourceId, + principalTable: "IdentityServerIdentityResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerIdentityResourceProperties", + columns: table => new + { + IdentityResourceId = table.Column(nullable: false), + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerIdentityResourceProperties", x => new { x.IdentityResourceId, x.Key, x.Value }); table.ForeignKey( - name: "FK_IdentityServerIdentityClaims_IdentityServerIdentityResources_IdentityResourceId", + name: "FK_IdentityServerIdentityResourceProperties_IdentityServerIdentityResources_IdentityResourceId", column: x => x.IdentityResourceId, principalTable: "IdentityServerIdentityResources", principalColumn: "Id", @@ -848,25 +952,6 @@ namespace MyCompanyName.MyProjectName.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "IdentityServerApiScopeClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiResourceId, x.Name, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiResourceId_Name", - columns: x => new { x.ApiResourceId, x.Name }, - principalTable: "IdentityServerApiScopes", - principalColumns: new[] { "ApiResourceId", "Name" }, - onDelete: ReferentialAction.Cascade); - }); - migrationBuilder.CreateIndex( name: "IX_AbpAuditLogActions_AuditLogId", table: "AbpAuditLogActions", @@ -982,6 +1067,18 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpUsers", column: "UserName"); + migrationBuilder.CreateIndex( + name: "IX_IdentityServerApiResources_Name", + table: "IdentityServerApiResources", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerApiScopes_Name", + table: "IdentityServerApiScopes", + column: "Name", + unique: true); + migrationBuilder.CreateIndex( name: "IX_IdentityServerClients_ClientId", table: "IdentityServerClients", @@ -1001,7 +1098,12 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_IdentityServerDeviceFlowCodes_UserCode", table: "IdentityServerDeviceFlowCodes", - column: "UserCode", + column: "UserCode"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerIdentityResources_Name", + table: "IdentityServerIdentityResources", + column: "Name", unique: true); migrationBuilder.CreateIndex( @@ -1013,6 +1115,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", table: "IdentityServerPersistedGrants", columns: new[] { "SubjectId", "ClientId", "Type" }); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_SubjectId_SessionId_Type", + table: "IdentityServerPersistedGrants", + columns: new[] { "SubjectId", "SessionId", "Type" }); } protected override void Down(MigrationBuilder migrationBuilder) @@ -1057,13 +1164,22 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpUserTokens"); migrationBuilder.DropTable( - name: "IdentityServerApiClaims"); + name: "IdentityServerApiResourceClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerApiResourceProperties"); + + migrationBuilder.DropTable( + name: "IdentityServerApiResourceScopes"); + + migrationBuilder.DropTable( + name: "IdentityServerApiResourceSecrets"); migrationBuilder.DropTable( name: "IdentityServerApiScopeClaims"); migrationBuilder.DropTable( - name: "IdentityServerApiSecrets"); + name: "IdentityServerApiScopeProperties"); migrationBuilder.DropTable( name: "IdentityServerClientClaims"); @@ -1096,7 +1212,10 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerDeviceFlowCodes"); migrationBuilder.DropTable( - name: "IdentityServerIdentityClaims"); + name: "IdentityServerIdentityResourceClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerIdentityResourceProperties"); migrationBuilder.DropTable( name: "IdentityServerPersistedGrants"); @@ -1116,6 +1235,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpUsers"); + migrationBuilder.DropTable( + name: "IdentityServerApiResources"); + migrationBuilder.DropTable( name: "IdentityServerApiScopes"); @@ -1127,9 +1249,6 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpAuditLogs"); - - migrationBuilder.DropTable( - name: "IdentityServerApiResources"); } } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs index 44c00e04d4..c2aac52e7c 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs @@ -772,12 +772,34 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpOrganizationUnitRoles"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResource", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnName("ConcurrencyStamp") @@ -834,15 +856,18 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties") - .HasColumnType("nvarchar(max)"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); + b.HasIndex("Name") + .IsUnique(); + b.ToTable("IdentityServerApiResources"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -853,18 +878,76 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("ApiResourceId", "Type"); - b.ToTable("IdentityServerApiClaims"); + b.ToTable("IdentityServerApiResourceClaims"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); - b.Property("Name") + b.Property("Scope") .HasColumnType("nvarchar(200)") .HasMaxLength(200); + b.HasKey("ApiResourceId", "Scope"); + + b.ToTable("IdentityServerApiResourceScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiResourceSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(40)") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + b.Property("Description") .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); @@ -876,58 +959,76 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Emphasize") .HasColumnType("bit"); + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + b.Property("Required") .HasColumnType("bit"); b.Property("ShowInDiscoveryDocument") .HasColumnType("bit"); - b.HasKey("ApiResourceId", "Name"); + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); b.ToTable("IdentityServerApiScopes"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => { - b.Property("ApiResourceId") + b.Property("ApiScopeId") .HasColumnType("uniqueidentifier"); - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - b.Property("Type") .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.HasKey("ApiResourceId", "Name", "Type"); + b.HasKey("ApiScopeId", "Type"); b.ToTable("IdentityServerApiScopeClaims"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => { - b.Property("ApiResourceId") + b.Property("ApiScopeId") .HasColumnType("uniqueidentifier"); - b.Property("Type") + b.Property("Key") .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("Description") .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.Property("Expiration") - .HasColumnType("datetime2"); + b.HasKey("ApiScopeId", "Key", "Value"); - b.HasKey("ApiResourceId", "Type", "Value"); - - b.ToTable("IdentityServerApiSecrets"); + b.ToTable("IdentityServerApiScopeProperties"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => @@ -957,6 +1058,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("AllowRememberConsent") .HasColumnType("bit"); + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + b.Property("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("bit"); @@ -1087,6 +1192,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("RequirePkce") .HasColumnType("bit"); + b.Property("RequireRequestObject") + .HasColumnType("bit"); + b.Property("SlidingRefreshTokenLifetime") .HasColumnType("int"); @@ -1191,11 +1299,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(250); b.Property("Value") - .IsRequired() .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); - b.HasKey("ClientId", "Key"); + b.HasKey("ClientId", "Key", "Value"); b.ToTable("IdentityServerClientProperties"); }); @@ -1283,6 +1390,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(max)") .HasMaxLength(50000); + b.Property("Description") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + b.Property("DeviceCode") .IsRequired() .HasColumnType("nvarchar(200)") @@ -1296,6 +1407,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("ExtraProperties") .HasColumnType("nvarchar(max)"); + b.Property("SessionId") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + b.Property("SubjectId") .HasColumnType("nvarchar(200)") .HasMaxLength(200); @@ -1312,8 +1427,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Expiration"); - b.HasIndex("UserCode") - .IsUnique(); + b.HasIndex("UserCode"); b.ToTable("IdentityServerDeviceFlowCodes"); }); @@ -1335,6 +1449,9 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(40)") .HasMaxLength(40); + b.Property("ConsumedTime") + .HasColumnType("datetime2"); + b.Property("CreationTime") .HasColumnType("datetime2"); @@ -1343,6 +1460,10 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(max)") .HasMaxLength(50000); + b.Property("Description") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + b.Property("Expiration") .HasColumnType("datetime2"); @@ -1353,6 +1474,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("SessionId") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + b.Property("SubjectId") .HasColumnType("nvarchar(200)") .HasMaxLength(200); @@ -1368,21 +1493,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "ClientId", "Type"); - b.ToTable("IdentityServerPersistedGrants"); - }); + b.HasIndex("SubjectId", "SessionId", "Type"); - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => - { - b.Property("IdentityResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("IdentityResourceId", "Type"); - - b.ToTable("IdentityServerIdentityClaims"); + b.ToTable("IdentityServerPersistedGrants"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => @@ -1450,9 +1563,6 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - b.Property("Required") .HasColumnType("bit"); @@ -1461,9 +1571,44 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); + b.HasIndex("Name") + .IsUnique(); + b.ToTable("IdentityServerIdentityResources"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityResourceClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("IdentityResourceId", "Key", "Value"); + + b.ToTable("IdentityServerIdentityResourceProperties"); + }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") @@ -1719,38 +1864,56 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + .WithMany("Properties") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + .WithMany("Secrets") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) .WithMany("UserClaims") - .HasForeignKey("ApiResourceId", "Name") + .HasForeignKey("ApiScopeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Secrets") - .HasForeignKey("ApiResourceId") + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("Properties") + .HasForeignKey("ApiScopeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); @@ -1836,7 +1999,7 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => { b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) .WithMany("UserClaims") @@ -1845,6 +2008,15 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("Properties") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { b.HasOne("Volo.Abp.TenantManagement.Tenant", null) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200624023340_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200707075539_Initial.Designer.cs similarity index 99% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200624023340_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200707075539_Initial.Designer.cs index d93e2804a6..ee1b9c6c25 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200624023340_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200707075539_Initial.Designer.cs @@ -11,7 +11,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20200624023340_Initial")] + [Migration("20200707075539_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200624023340_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200707075539_Initial.cs similarity index 100% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200624023340_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200707075539_Initial.cs From 87e5dc425980000af692235d1930abe7bb518d0d Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 7 Jul 2020 16:58:54 +0800 Subject: [PATCH 17/32] Refactor. --- .../ApiResources/ApiResource.cs | 3 +- .../ApiResources/ApiResourceClaim.cs | 4 +- .../ApiResources/ApiResourceScope.cs | 2 +- .../ApiResources/ApiResourceSecret.cs | 2 +- .../ApiResources/IApiResourceRepository.cs | 2 +- .../Volo/Abp/IdentityServer/ResourceStore.cs | 7 +- ...IdentityServerEfCoreQueryableExtensions.cs | 1 + .../ApiResources/ApiResourceRepository.cs | 5 +- ...IdentityServerEntityFrameworkCoreModule.cs | 1 + ...yServerDbContextModelCreatingExtensions.cs | 5 -- .../AbpIdentityServerMongoDbContext.cs | 1 + ...pIdentityServerMongoDbContextExtensions.cs | 1 + .../MongoDB/AbpIdentityServerMongoDbModule.cs | 1 + .../IAbpIdentityServerMongoDbContext.cs | 2 +- .../MongoDB/MongoApiResourceRepository.cs | 1 + .../Clients/ClientStore_Tests.cs | 2 +- .../AbpIdentityServerTestDataBuilder.cs | 87 +++++++++++-------- .../AbpIdentityServerTestDataBuilder.cs | 1 + .../ApiResourceRepository_Tests.cs | 1 + .../IdentityServerDataSeedContributor.cs | 3 +- .../IdentityServerDataSeedContributor.cs | 7 +- 21 files changed, 79 insertions(+), 60 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs index e6fe3b9318..90725c3f6a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs @@ -4,9 +4,8 @@ using System.Linq; using IdentityServer4; using JetBrains.Annotations; using Volo.Abp.Domain.Entities.Auditing; -using Volo.Abp.IdentityServer.ApiResources; -namespace Volo.Abp.IdentityServer.ApiScopes +namespace Volo.Abp.IdentityServer.ApiResources { public class ApiResource : FullAuditedAggregateRoot { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs index e3e92d0721..772f6dcde7 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs @@ -1,7 +1,7 @@ using System; using JetBrains.Annotations; -namespace Volo.Abp.IdentityServer.ApiScopes +namespace Volo.Abp.IdentityServer.ApiResources { public class ApiResourceClaim : UserClaim { @@ -28,4 +28,4 @@ namespace Volo.Abp.IdentityServer.ApiScopes return new object[] {ApiResourceId, Type}; } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs index ecdff780e9..4da2beaa3f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceScope.cs @@ -2,7 +2,7 @@ using JetBrains.Annotations; using Volo.Abp.Domain.Entities; -namespace Volo.Abp.IdentityServer.ApiScopes +namespace Volo.Abp.IdentityServer.ApiResources { public class ApiResourceScope : Entity { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs index ccf63b8a3c..dcc6b04768 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceSecret.cs @@ -2,7 +2,7 @@ using IdentityServer4; using JetBrains.Annotations; -namespace Volo.Abp.IdentityServer.ApiScopes +namespace Volo.Abp.IdentityServer.ApiResources { public class ApiResourceSecret : Secret { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs index f2feff8917..5d99666183 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; -namespace Volo.Abp.IdentityServer.ApiScopes +namespace Volo.Abp.IdentityServer.ApiResources { public interface IApiResourceRepository : IBasicRepository { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs index a2d13c72fd..5afaaf4400 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Threading.Tasks; using IdentityServer4.Models; using IdentityServer4.Stores; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.ObjectMapping; @@ -52,7 +53,7 @@ namespace Volo.Abp.IdentityServer public virtual async Task> FindApiResourcesByScopeNameAsync(IEnumerable scopeNames) { var resources = await ApiResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true); - return ObjectMapper.Map, List>(resources); + return ObjectMapper.Map, List>(resources); } /// @@ -61,7 +62,7 @@ namespace Volo.Abp.IdentityServer public virtual async Task> FindApiResourcesByNameAsync(IEnumerable apiResourceNames) { var resources = await ApiResourceRepository.FindByNameAsync(apiResourceNames.ToArray(), includeDetails: true); - return ObjectMapper.Map, List>(resources); + return ObjectMapper.Map, List>(resources); } /// @@ -75,7 +76,7 @@ namespace Volo.Abp.IdentityServer return new Resources( ObjectMapper.Map, List>(identityResources), - ObjectMapper.Map, List>(apiResources), + ObjectMapper.Map, List>(apiResources), ObjectMapper.Map, List>(apiScopes)); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs index d830da07e0..58cb6cc7ac 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/AbpIdentityServerEfCoreQueryableExtensions.cs @@ -1,5 +1,6 @@ using System.Linq; using Microsoft.EntityFrameworkCore; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.IdentityResources; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index 53644a1e1c..4824696108 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -1,16 +1,15 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Dynamic.Core; using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.IdentityServer.EntityFrameworkCore; -using System.Linq.Dynamic.Core; -using System.Runtime.InteropServices.ComTypes; -namespace Volo.Abp.IdentityServer.ApiScopes +namespace Volo.Abp.IdentityServer.ApiResources { public class ApiResourceRepository : EfCoreRepository, IApiResourceRepository { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs index fd22e97fe4..adc51cd500 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index 20a99c082e..eb6d424c16 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -8,11 +8,6 @@ using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; -using ApiResource = Volo.Abp.IdentityServer.ApiScopes.ApiResource; -using Client = Volo.Abp.IdentityServer.Clients.Client; -using ClientClaim = Volo.Abp.IdentityServer.Clients.ClientClaim; -using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; -using PersistedGrant = Volo.Abp.IdentityServer.Grants.PersistedGrant; namespace Volo.Abp.IdentityServer.EntityFrameworkCore { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs index 760505e75f..eddf19cd29 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs @@ -1,5 +1,6 @@ using MongoDB.Driver; using Volo.Abp.Data; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs index 026312312a..6abfc0618d 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs @@ -1,4 +1,5 @@ using System; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs index 1924ad3a68..6cd13aac37 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs index ad1cfbfcf5..5b521f2600 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs @@ -1,12 +1,12 @@ using MongoDB.Driver; using Volo.Abp.Data; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.MongoDB; -using ApiResource = Volo.Abp.IdentityServer.ApiScopes.ApiResource; namespace Volo.Abp.IdentityServer.MongoDB { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index c7a93cdb60..55a0cece76 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -8,6 +8,7 @@ using MongoDB.Driver.Linq; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.IdentityServer.ApiScopes; using System.Linq.Dynamic.Core; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.MongoDB; namespace Volo.Abp.IdentityServer.MongoDB diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs index e89f385b57..326edfd4ac 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs @@ -33,7 +33,7 @@ namespace Volo.Abp.IdentityServer.Clients client.ClientId.ShouldBe("42"); client.ProtocolType.ShouldBe("TestProtocol-42"); client.AllowedCorsOrigins.ShouldContain("Origin1"); - client.AllowedScopes.ShouldContain("api1"); + client.AllowedScopes.ShouldContain("Test-ApiScope-Name-1"); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index 52fbc0513a..4b16d7de65 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -2,11 +2,13 @@ using IdentityServer4.Models; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; -using ApiResource = Volo.Abp.IdentityServer.ApiScopes.ApiResource; +using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; +using ApiScope = Volo.Abp.IdentityServer.ApiScopes.ApiScope; using Client = Volo.Abp.IdentityServer.Clients.Client; using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; using PersistedGrant = Volo.Abp.IdentityServer.Grants.PersistedGrant; @@ -21,6 +23,7 @@ namespace Volo.Abp.IdentityServer private readonly IClientRepository _clientRepository; private readonly IPersistentGrantRepository _persistentGrantRepository; private readonly IApiResourceRepository _apiResourceRepository; + private readonly IApiScopeRepository _apiScopeRepository; private readonly IIdentityResourceRepository _identityResourceRepository; public AbpIdentityServerTestDataBuilder( @@ -28,21 +31,64 @@ namespace Volo.Abp.IdentityServer IGuidGenerator guidGenerator, IPersistentGrantRepository persistentGrantRepository, IApiResourceRepository apiResourceRepository, - IIdentityResourceRepository identityResourceRepository) + IIdentityResourceRepository identityResourceRepository, + IApiScopeRepository apiScopeRepository) { _clientRepository = clientRepository; _guidGenerator = guidGenerator; _persistentGrantRepository = persistentGrantRepository; _apiResourceRepository = apiResourceRepository; _identityResourceRepository = identityResourceRepository; + _apiScopeRepository = apiScopeRepository; } public async Task BuildAsync() { - await AddClients(); - await AddPersistentGrants(); await AddApiResources(); + await AddApiScopes(); await AddIdentityResources(); + await AddClients(); + await AddPersistentGrants(); + } + + private async Task AddApiResources() + { + var apiResource = new ApiResource(_guidGenerator.Create(), "Test-ApiResource-Name-1") + { + Enabled = true, + Description = "Test-ApiResource-Description-1", + DisplayName = "Test-ApiResource-DisplayName-1" + }; + + apiResource.AddSecret("secret".Sha256()); + apiResource.AddScope("Test-ApiResource-ApiScope-Name-1"); + apiResource.AddScope("Test-ApiResource-ApiScope-DisplayName-1"); + apiResource.AddUserClaim("Test-ApiResource-Claim-Type-1"); + + await _apiResourceRepository.InsertAsync(apiResource); + } + + private async Task AddApiScopes() + { + var apiScope = new ApiScope(_guidGenerator.Create(), "Test-ApiScope-Name-1"); + + apiScope.AddUserClaim("Test-ApiScope-Claim-Type-1"); + await _apiScopeRepository.InsertAsync(apiScope); + } + + private async Task AddIdentityResources() + { + var identityResource = new IdentityResource(_guidGenerator.Create(), "Test-Identity-Resource-Name-1") + { + Description = "Test-Identity-Resource-Description-1", + DisplayName = "Test-Identity-Resource-DisplayName-1", + Required = true, + Emphasize = true + }; + + identityResource.AddUserClaim("Test-Identity-Resource-1-IdentityClaim-Type-1"); + + await _identityResourceRepository.InsertAsync(identityResource); } private async Task AddClients() @@ -54,7 +100,7 @@ namespace Volo.Abp.IdentityServer client42.AddCorsOrigin("Origin1"); - client42.AddScope("api1"); + client42.AddScope("Test-ApiScope-Name-1"); await _clientRepository.InsertAsync(client42); } @@ -98,36 +144,5 @@ namespace Volo.Abp.IdentityServer }); } - private async Task AddApiResources() - { - var apiResource = new ApiResource(_guidGenerator.Create(), "Test-ApiResource-Name-1") - { - Enabled = true, - Description = "Test-ApiResource-Description-1", - DisplayName = "Test-ApiResource-DisplayName-1" - }; - - apiResource.AddSecret("secret".Sha256()); - apiResource.AddScope("Test-ApiResource-ApiScope-Name-1"); - apiResource.AddScope("Test-ApiResource-ApiScope-DisplayName-1"); - apiResource.AddUserClaim("Test-ApiResource-Claim-Type-1"); - - await _apiResourceRepository.InsertAsync(apiResource); - } - - private async Task AddIdentityResources() - { - var identityResource = new IdentityResource(_guidGenerator.Create(), "Test-Identity-Resource-Name-1") - { - Description = "Test-Identity-Resource-Description-1", - DisplayName = "Test-Identity-Resource-DisplayName-1", - Required = true, - Emphasize = true - }; - - identityResource.AddUserClaim("Test-Identity-Resource-1-IdentityClaim-Type-1"); - - await _identityResourceRepository.InsertAsync(identityResource); - } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index a2cf0f428c..436bef1246 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using Volo.Abp.Identity; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs index d3350ab59f..08c900947a 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Shouldly; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.Modularity; using Xunit; diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs index 0662482b65..3aa7af4691 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs @@ -8,11 +8,12 @@ using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using Volo.Abp.IdentityServer.ApiScopes; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.PermissionManagement; using Volo.Abp.Uow; -using ApiResource = Volo.Abp.IdentityServer.ApiScopes.ApiResource; +using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; using ApiScope = Volo.Abp.IdentityServer.ApiScopes.ApiScope; using Client = Volo.Abp.IdentityServer.Clients.Client; diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs index 7937265409..c3213311a1 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs @@ -8,11 +8,12 @@ using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using Volo.Abp.IdentityServer.ApiScopes; +using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.PermissionManagement; using Volo.Abp.Uow; -using ApiResource = Volo.Abp.IdentityServer.ApiScopes.ApiResource; +using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; using ApiScope = Volo.Abp.IdentityServer.ApiScopes.ApiScope; using Client = Volo.Abp.IdentityServer.Clients.Client; @@ -142,14 +143,14 @@ namespace MyCompanyName.MyProjectName.IdentityServer } //Console Test Client - var consoleClientId = configurationSection["MyProjectName_App:ClientId"]; + var consoleClientId = configurationSection["MyProjectName_ConsoleTestApp:ClientId"]; if (!consoleClientId.IsNullOrWhiteSpace()) { await CreateClientAsync( name: consoleClientId, scopes: commonScopes, grantTypes: new[] {"password", "client_credentials"}, - secret: (configurationSection["MyProjectName_App:ClientSecret"] ?? "1q2w3e*").Sha256() + secret: (configurationSection["MyProjectName_ConsoleTestApp:ClientSecret"] ?? "1q2w3e*").Sha256() ); } } From b6676dc54c9c482582faff73a6e5dc2fe5fb85d4 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 14 Jul 2020 15:01:11 +0800 Subject: [PATCH 18/32] Add some methods. --- .../Localization/Resources/en.json | 3 +- .../Localization/Resources/zh-Hans.json | 3 +- .../ApiScopes/IApiScopeeRepository.cs | 20 ++++++++- .../IdentityResources/IdentityResource.cs | 20 +++++++++ .../ApiResources/ApiResourceRepository.cs | 14 +++++- .../ApiScopes/ApiScopeRepository.cs | 45 ++++++++++++++++++- .../MongoDB/MongoApiResourceRepository.cs | 2 +- .../MongoDB/MongoApiScopeRepository.cs | 22 ++++++++- 8 files changed, 120 insertions(+), 9 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/en.json b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/en.json index f974297b06..22b5f13474 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/en.json +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/en.json @@ -3,10 +3,11 @@ "texts": { "Volo.IdentityServer:DuplicateIdentityResourceName": "Identity Resource name already exist: {Name}", "Volo.IdentityServer:DuplicateApiResourceName": "Api Resource name already exist: {Name}", + "Volo.IdentityServer:DuplicateApiScopeName": "Api Scope name already exist: {Name}", "Volo.IdentityServer:DuplicateClientId": "ClientId already exist: {ClientId}", "UserLockedOut": "The user account has been locked out due to invalid login attempts. Please wait a while and try again.", "InvalidUserNameOrPassword": "Invalid username or password!", "LoginIsNotAllowed": "You are not allowed to login! You need to confirm your email/phone number.", "InvalidUsername": "Invalid username or password!" } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hans.json b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hans.json index ac175e574d..1d40aa16b3 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hans.json +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hans.json @@ -3,10 +3,11 @@ "texts": { "Volo.IdentityServer:DuplicateIdentityResourceName": "Identity资源名称已存在: {Name}", "Volo.IdentityServer:DuplicateApiResourceName": "Api资源名称已存在: {Name}", + "Volo.IdentityServer:DuplicateApiScopeName": "Api Scope已存在: {Name}", "Volo.IdentityServer:DuplicateClientId": "ClientId已经存在: {ClientId}", "UserLockedOut": "登录失败,用户账户已被锁定.请稍后再试.", "InvalidUserNameOrPassword": "用户名或密码错误!", "LoginIsNotAllowed": "无法登录!你需要验证邮箱地址/手机号.", "InvalidUsername": "用户名或密码错误!" } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeeRepository.cs index c6ebcc26e5..a0aba8fe2a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeeRepository.cs @@ -1,11 +1,12 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; namespace Volo.Abp.IdentityServer.ApiScopes { - public interface IApiScopeRepository : IBasicRepository + public interface IApiScopeRepository : IBasicRepository { Task GetByNameAsync( string scopeName, @@ -18,5 +19,20 @@ namespace Volo.Abp.IdentityServer.ApiScopes bool includeDetails = false, CancellationToken cancellationToken = default ); + + Task> GetListAsync( + string sorting, + int skipCount, + int maxResultCount, + string filter = null, + bool includeDetails = false, + CancellationToken cancellationToken = default + ); + + Task CheckNameExistAsync( + string name, + Guid? expectedId = null, + CancellationToken cancellationToken = default + ); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs index 246e1ddf98..b5812da7e2 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs @@ -89,5 +89,25 @@ namespace Volo.Abp.IdentityServer.IdentityResources { return UserClaims.FirstOrDefault(c => c.Type == type); } + + public virtual void AddProperty([NotNull] string key, string value) + { + Properties.Add(new IdentityResourceProperty(Id, key, value)); + } + + public virtual void RemoveAllProperties() + { + Properties.Clear(); + } + + public virtual void RemoveProperty(string key) + { + Properties.RemoveAll(r => r.Key == key); + } + + public virtual IdentityResourceProperty FindProperty(string key) + { + return Properties.FirstOrDefault(r => r.Key == key); + } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index 4824696108..6718b20fb8 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -68,7 +68,7 @@ namespace Volo.Abp.IdentityServer.ApiResources public virtual async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await DbSet.AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken); + return await DbSet.AnyAsync(ar => ar.Id != expectedId && ar.Name == name, GetCancellationToken(cancellationToken)); } public override async Task DeleteAsync(Guid id, bool autoSave = false, CancellationToken cancellationToken = default) @@ -85,6 +85,18 @@ namespace Volo.Abp.IdentityServer.ApiResources DbContext.Set().Remove(scope); } + var resourceSecrets = DbContext.Set().Where(s => s.ApiResourceId == id); + foreach (var secret in resourceSecrets) + { + DbContext.Set().Remove(secret); + } + + var apiResourceProperties = DbContext.Set().Where(s => s.ApiResourceId == id); + foreach (var property in apiResourceProperties) + { + DbContext.Set().Remove(property); + } + await base.DeleteAsync(id, autoSave, cancellationToken); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs index b4674aad37..88772bfab7 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs @@ -1,5 +1,7 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; +using System.Linq.Dynamic.Core; using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; @@ -9,7 +11,7 @@ using Volo.Abp.IdentityServer.EntityFrameworkCore; namespace Volo.Abp.IdentityServer.ApiScopes { - public class ApiScopeRepository : EfCoreRepository, IApiScopeRepository + public class ApiScopeRepository : EfCoreRepository, IApiScopeRepository { public ApiScopeRepository(IDbContextProvider dbContextProvider) : base( dbContextProvider) @@ -30,5 +32,44 @@ namespace Volo.Abp.IdentityServer.ApiScopes return await query.ToListAsync(GetCancellationToken(cancellationToken)); } + + public async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default) + { + return await DbSet + .IncludeDetails(includeDetails) + .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .OrderBy(sorting ?? "name desc") + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) + { + return await DbSet.AnyAsync(x => x.Id != expectedId && x.Name == name, GetCancellationToken(cancellationToken)); + } + + public override async Task DeleteAsync(Guid id, bool autoSave = false, CancellationToken cancellationToken = new CancellationToken()) + { + var scopeClaims = DbContext.Set().Where(sc => sc.ApiScopeId == id); + foreach (var claim in scopeClaims) + { + DbContext.Set().Remove(claim); + } + + var scopeProperties = DbContext.Set().Where(s => s.ApiScopeId == id); + foreach (var property in scopeProperties) + { + DbContext.Set().Remove(property); + } + + await base.DeleteAsync(id, autoSave, cancellationToken); + } + + public override IQueryable WithDetails() + { + return GetQueryable().IncludeDetails(); + } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index 55a0cece76..0f4337b895 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -63,7 +63,7 @@ namespace Volo.Abp.IdentityServer.MongoDB public virtual async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken); + return await GetMongoQueryable().AnyAsync(ar => ar.Id != expectedId && ar.Name == name, GetCancellationToken(cancellationToken)); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs index 8a20b8ae2b..a446e772e8 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs @@ -1,12 +1,13 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; -using System.Linq; using MongoDB.Driver; using MongoDB.Driver.Linq; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.IdentityServer.ApiScopes; +using System.Linq.Dynamic.Core; using Volo.Abp.MongoDB; namespace Volo.Abp.IdentityServer.MongoDB @@ -33,5 +34,24 @@ namespace Volo.Abp.IdentityServer.MongoDB return await query.ToListAsync(GetCancellationToken(cancellationToken)); } + + public async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, bool includeDetails = false, + CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .WhereIf(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .OrderBy(sorting ?? nameof(ApiScope.Name)) + .As>() + .PageBy>(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) + { + return await GetMongoQueryable().AnyAsync(x => x.Id != expectedId && x.Name == name, GetCancellationToken(cancellationToken)); + } } } From 2fd086ea0cd60022e1cf857136d8d135b7685533 Mon Sep 17 00:00:00 2001 From: "lyon.han" Date: Thu, 30 Jul 2020 17:14:46 +0800 Subject: [PATCH 19/32] Update ClientRepository.cs --- .../Volo/Abp/IdentityServer/Clients/ClientRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs index 5b350d0365..6151d3fe03 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.IdentityServer.Clients } - public virtual async Task FindByCliendIdAsync( + public virtual async Task FindByClientIdAsync( string clientId, bool includeDetails = true, CancellationToken cancellationToken = default) From 9a3f363d3b6bb2f40bdb1f254f4afcf3d51b234e Mon Sep 17 00:00:00 2001 From: "lyon.han" Date: Thu, 30 Jul 2020 17:16:30 +0800 Subject: [PATCH 20/32] Update MongoClientRepository.cs --- .../Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs index 5855c42513..3f747e963d 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.IdentityServer.MongoDB { } - public virtual async Task FindByCliendIdAsync( + public virtual async Task FindByClientIdAsync( string clientId, bool includeDetails = true, CancellationToken cancellationToken = default) From 2423481c93182c6015c91f36e3b2a9409435ccb5 Mon Sep 17 00:00:00 2001 From: "lyon.han" Date: Thu, 30 Jul 2020 17:18:54 +0800 Subject: [PATCH 21/32] Update CorsPolicyService_Tests.cs --- .../Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs index af701cfc69..9f15cf56c1 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.IdentityServer using (var uow = _unitOfWorkManager.Begin()) { - var client1 = await _clientRepository.FindByCliendIdAsync("ClientId1"); + var client1 = await _clientRepository.FindByClientIdAsync("ClientId1"); client1.AddCorsOrigin("https://new-origin.com"); await _clientRepository.UpdateAsync(client1); From 08368c91d5b619f40b10dd9b99ca891c3f75bd11 Mon Sep 17 00:00:00 2001 From: "lyon.han" Date: Thu, 30 Jul 2020 17:20:42 +0800 Subject: [PATCH 22/32] Update ClientRepository_Tests.cs --- .../Volo/Abp/IdentityServer/ClientRepository_Tests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs index 86f69610f5..8705a142ab 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs @@ -19,9 +19,9 @@ namespace Volo.Abp.IdentityServer } [Fact] - public async Task FindByCliendIdAsync() + public async Task FindByClientIdAsync() { - (await clientRepository.FindByCliendIdAsync("ClientId2")).ShouldNotBeNull(); + (await clientRepository.FindByClientIdAsync("ClientId2")).ShouldNotBeNull(); } [Fact] From 3be92953c8c42b7d54437b7bed44cc155958fd18 Mon Sep 17 00:00:00 2001 From: "lyon.han" Date: Thu, 30 Jul 2020 17:28:39 +0800 Subject: [PATCH 23/32] Update ClientStore.cs --- .../Volo/Abp/IdentityServer/Clients/ClientStore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs index 2486bb0413..100d0e4184 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.IdentityServer.Clients public virtual async Task FindClientByIdAsync(string clientId) { - var client = await ClientRepository.FindByCliendIdAsync(clientId); + var client = await ClientRepository.FindByClientIdAsync(clientId); return ObjectMapper.Map(client); } } From 3b43b8d17ca8484c879a60339f8c33c04433b029 Mon Sep 17 00:00:00 2001 From: "lyon.han" Date: Thu, 30 Jul 2020 17:30:45 +0800 Subject: [PATCH 24/32] Update IClientRepository.cs Spelling mistakes --- .../Volo/Abp/IdentityServer/Clients/IClientRepository.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs index 606b0086bd..059882eb47 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.IdentityServer.Clients { public interface IClientRepository : IBasicRepository { - Task FindByCliendIdAsync( + Task FindByClientIdAsync( [NotNull] string clientId, bool includeDetails = true, CancellationToken cancellationToken = default @@ -32,4 +32,4 @@ namespace Volo.Abp.IdentityServer.Clients CancellationToken cancellationToken = default ); } -} \ No newline at end of file +} From 31f7ea37ef44281945a601547b232f33a7466298 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Thu, 30 Jul 2020 18:28:28 +0800 Subject: [PATCH 25/32] Update template projects migration. --- .../20200710064926_Initial.Designer.cs | 2025 ----------------- .../Migrations/20200710064926_Initial.cs | 1235 ---------- .../20200730102617_Initial.Designer.cs} | 232 +- .../Migrations/20200730102617_Initial.cs} | 100 + ...ectNameMigrationsDbContextModelSnapshot.cs | 64 +- .../20200710065039_Initial.Designer.cs | 1936 ---------------- .../Migrations/20200710065039_Initial.cs | 1183 ---------- .../20200730102718_Initial.Designer.cs} | 232 +- .../Migrations/20200730102718_Initial.cs} | 100 +- ...verHostMigrationsDbContextModelSnapshot.cs | 64 +- .../20200707075539_Initial.Designer.cs | 1043 --------- ....cs => 20200730102724_Initial.Designer.cs} | 2 +- ...2_Initial.cs => 20200730102724_Initial.cs} | 0 13 files changed, 520 insertions(+), 7696 deletions(-) delete mode 100644 templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200710064926_Initial.Designer.cs delete mode 100644 templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200710064926_Initial.cs rename templates/{module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.Designer.cs => app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200730102617_Initial.Designer.cs} (91%) rename templates/{module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.cs => app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200730102617_Initial.cs} (92%) delete mode 100644 templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200710065039_Initial.Designer.cs delete mode 100644 templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200710065039_Initial.cs rename templates/{app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.Designer.cs => module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200730102718_Initial.Designer.cs} (95%) rename templates/{app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.cs => module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200730102718_Initial.cs} (97%) delete mode 100644 templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200707075539_Initial.Designer.cs rename templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/{20200710065052_Initial.Designer.cs => 20200730102724_Initial.Designer.cs} (99%) rename templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/{20200710065052_Initial.cs => 20200730102724_Initial.cs} (100%) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200710064926_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200710064926_Initial.Designer.cs deleted file mode 100644 index e2ca97db45..0000000000 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200710064926_Initial.Designer.cs +++ /dev/null @@ -1,2025 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyCompanyName.MyProjectName.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore; - -namespace MyCompanyName.MyProjectName.Migrations -{ - [DbContext(typeof(MyProjectNameMigrationsDbContext))] - [Migration("20200710064926_Initial")] - partial class Initial - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "3.1.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ApplicationName") - .HasColumnName("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); - - b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("ClientId") - .HasColumnName("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ClientName") - .HasColumnName("ClientName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Comments") - .HasColumnName("Comments") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CorrelationId") - .HasColumnName("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Exceptions") - .HasColumnName("Exceptions") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); - - b.Property("ExecutionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("HttpMethod") - .HasColumnName("HttpMethod") - .HasColumnType("nvarchar(16)") - .HasMaxLength(16); - - b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); - - b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantName") - .HasColumnType("nvarchar(max)"); - - b.Property("Url") - .HasColumnName("Url") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserName") - .HasColumnName("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ExecutionTime"); - - b.HasIndex("TenantId", "UserId", "ExecutionTime"); - - b.ToTable("AbpAuditLogs"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); - - b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); - - b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("MethodName") - .HasColumnName("MethodName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Parameters") - .HasColumnName("Parameters") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ServiceName") - .HasColumnName("ServiceName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - - b.ToTable("AbpAuditLogActions"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); - - b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); - - b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); - - b.Property("EntityId") - .IsRequired() - .HasColumnName("EntityId") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("EntityTenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("EntityTypeFullName") - .IsRequired() - .HasColumnName("EntityTypeFullName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - - b.ToTable("AbpEntityChanges"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("EntityChangeId") - .HasColumnType("uniqueidentifier"); - - b.Property("NewValue") - .HasColumnName("NewValue") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("OriginalValue") - .HasColumnName("OriginalValue") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("PropertyName") - .IsRequired() - .HasColumnName("PropertyName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("PropertyTypeFullName") - .IsRequired() - .HasColumnName("PropertyTypeFullName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("EntityChangeId"); - - b.ToTable("AbpEntityPropertyChanges"); - }); - - modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsAbandoned") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("JobArgs") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(1048576); - - b.Property("JobName") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("LastTryTime") - .HasColumnType("datetime2"); - - b.Property("NextTryTime") - .HasColumnType("datetime2"); - - b.Property("Priority") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint") - .HasDefaultValue((byte)15); - - b.Property("TryCount") - .ValueGeneratedOnAdd() - .HasColumnType("smallint") - .HasDefaultValue((short)0); - - b.HasKey("Id"); - - b.HasIndex("IsAbandoned", "NextTryTime"); - - b.ToTable("AbpBackgroundJobs"); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpFeatureValues"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsStatic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("Regex") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("RegexDescription") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ValueType") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("AbpClaimTypes"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDefault") - .HasColumnName("IsDefault") - .HasColumnType("bit"); - - b.Property("IsPublic") - .HasColumnName("IsPublic") - .HasColumnType("bit"); - - b.Property("IsStatic") - .HasColumnName("IsStatic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("NormalizedName") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName"); - - b.ToTable("AbpRoles"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ClaimType") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AbpRoleClaims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Action") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); - - b.Property("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); - - b.Property("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("CreationTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("Identity") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Action"); - - b.HasIndex("TenantId", "ApplicationName"); - - b.HasIndex("TenantId", "Identity"); - - b.HasIndex("TenantId", "UserId"); - - b.ToTable("AbpSecurityLogs"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .ValueGeneratedOnAdd() - .HasColumnName("AccessFailedCount") - .HasColumnType("int") - .HasDefaultValue(0); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnName("Email") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("EmailConfirmed") - .ValueGeneratedOnAdd() - .HasColumnName("EmailConfirmed") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("LockoutEnabled") - .ValueGeneratedOnAdd() - .HasColumnName("LockoutEnabled") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("Name") - .HasColumnName("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("NormalizedEmail") - .IsRequired() - .HasColumnName("NormalizedEmail") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("NormalizedUserName") - .IsRequired() - .HasColumnName("NormalizedUserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("PasswordHash") - .HasColumnName("PasswordHash") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("PhoneNumber") - .HasColumnName("PhoneNumber") - .HasColumnType("nvarchar(16)") - .HasMaxLength(16); - - b.Property("PhoneNumberConfirmed") - .ValueGeneratedOnAdd() - .HasColumnName("PhoneNumberConfirmed") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("SecurityStamp") - .IsRequired() - .HasColumnName("SecurityStamp") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("Surname") - .HasColumnName("Surname") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("TwoFactorEnabled") - .ValueGeneratedOnAdd() - .HasColumnName("TwoFactorEnabled") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("UserName") - .IsRequired() - .HasColumnName("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("Email"); - - b.HasIndex("NormalizedEmail"); - - b.HasIndex("NormalizedUserName"); - - b.HasIndex("UserName"); - - b.ToTable("AbpUsers"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ClaimType") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AbpUserClaims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "LoginProvider"); - - b.HasIndex("LoginProvider", "ProviderKey"); - - b.ToTable("AbpUserLogins"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => - { - b.Property("OrganizationUnitId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("OrganizationUnitId", "UserId"); - - b.HasIndex("UserId", "OrganizationUnitId"); - - b.ToTable("AbpUserOrganizationUnits"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId", "UserId"); - - b.ToTable("AbpUserRoles"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Name") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AbpUserTokens"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnName("Code") - .HasColumnType("nvarchar(95)") - .HasMaxLength(95); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("DisplayName") - .IsRequired() - .HasColumnName("DisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("Code"); - - b.HasIndex("ParentId"); - - b.ToTable("AbpOrganizationUnits"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => - { - b.Property("OrganizationUnitId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("OrganizationUnitId", "RoleId"); - - b.HasIndex("RoleId", "OrganizationUnitId"); - - b.ToTable("AbpOrganizationUnitRoles"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("IdentityServerApiResources"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ApiResourceId", "Type"); - - b.ToTable("IdentityServerApiClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Emphasize") - .HasColumnType("bit"); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ShowInDiscoveryDocument") - .HasColumnType("bit"); - - b.HasKey("ApiResourceId", "Name"); - - b.ToTable("IdentityServerApiScopes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ApiResourceId", "Name", "Type"); - - b.ToTable("IdentityServerApiScopeClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.HasKey("ApiResourceId", "Type", "Value"); - - b.ToTable("IdentityServerApiSecrets"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AbsoluteRefreshTokenLifetime") - .HasColumnType("int"); - - b.Property("AccessTokenLifetime") - .HasColumnType("int"); - - b.Property("AccessTokenType") - .HasColumnType("int"); - - b.Property("AllowAccessTokensViaBrowser") - .HasColumnType("bit"); - - b.Property("AllowOfflineAccess") - .HasColumnType("bit"); - - b.Property("AllowPlainTextPkce") - .HasColumnType("bit"); - - b.Property("AllowRememberConsent") - .HasColumnType("bit"); - - b.Property("AlwaysIncludeUserClaimsInIdToken") - .HasColumnType("bit"); - - b.Property("AlwaysSendClientClaims") - .HasColumnType("bit"); - - b.Property("AuthorizationCodeLifetime") - .HasColumnType("int"); - - b.Property("BackChannelLogoutSessionRequired") - .HasColumnType("bit"); - - b.Property("BackChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ClientClaimsPrefix") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("ConsentLifetime") - .HasColumnType("int"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DeviceCodeLifetime") - .HasColumnType("int"); - - b.Property("EnableLocalLogin") - .HasColumnType("bit"); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("FrontChannelLogoutSessionRequired") - .HasColumnType("bit"); - - b.Property("FrontChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("IdentityTokenLifetime") - .HasColumnType("int"); - - b.Property("IncludeJwtId") - .HasColumnType("bit"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("LogoUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("PairWiseSubjectSalt") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ProtocolType") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("RefreshTokenExpiration") - .HasColumnType("int"); - - b.Property("RefreshTokenUsage") - .HasColumnType("int"); - - b.Property("RequireClientSecret") - .HasColumnType("bit"); - - b.Property("RequireConsent") - .HasColumnType("bit"); - - b.Property("RequirePkce") - .HasColumnType("bit"); - - b.Property("SlidingRefreshTokenLifetime") - .HasColumnType("int"); - - b.Property("UpdateAccessTokenClaimsOnRefresh") - .HasColumnType("bit"); - - b.Property("UserCodeType") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); - - b.Property("UserSsoLifetime") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.ToTable("IdentityServerClients"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.HasKey("ClientId", "Type", "Value"); - - b.ToTable("IdentityServerClientClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Origin") - .HasColumnType("nvarchar(150)") - .HasMaxLength(150); - - b.HasKey("ClientId", "Origin"); - - b.ToTable("IdentityServerClientCorsOrigins"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("GrantType") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.HasKey("ClientId", "GrantType"); - - b.ToTable("IdentityServerClientGrantTypes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Provider") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ClientId", "Provider"); - - b.ToTable("IdentityServerClientIdPRestrictions"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("PostLogoutRedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "PostLogoutRedirectUri"); - - b.ToTable("IdentityServerClientPostLogoutRedirectUris"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "Key"); - - b.ToTable("IdentityServerClientProperties"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("RedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "RedirectUri"); - - b.ToTable("IdentityServerClientRedirectUris"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ClientId", "Scope"); - - b.ToTable("IdentityServerClientScopes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.HasKey("ClientId", "Type", "Value"); - - b.ToTable("IdentityServerClientSecrets"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Data") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); - - b.Property("DeviceCode") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Expiration") - .IsRequired() - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("UserCode") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("Id"); - - b.HasIndex("DeviceCode") - .IsUnique(); - - b.HasIndex("Expiration"); - - b.HasIndex("UserCode") - .IsUnique(); - - b.ToTable("IdentityServerDeviceFlowCodes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => - { - b.Property("Key") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(50)") - .HasMaxLength(50); - - b.HasKey("Key"); - - b.HasIndex("Expiration"); - - b.HasIndex("SubjectId", "ClientId", "Type"); - - b.ToTable("IdentityServerPersistedGrants"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => - { - b.Property("IdentityResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("IdentityResourceId", "Type"); - - b.ToTable("IdentityServerIdentityClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Emphasize") - .HasColumnType("bit"); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ShowInDiscoveryDocument") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("IdentityServerIdentityResources"); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpPermissionGrants"); - }); - - modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpSettings"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("AbpTenants"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.HasKey("TenantId", "Name"); - - b.ToTable("AbpTenantConnectionStrings"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("Actions") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("EntityChanges") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) - .WithMany("PropertyChanges") - .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany("Claims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Claims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany() - .HasForeignKey("OrganizationUnitId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("OrganizationUnits") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Roles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany() - .HasForeignKey("ParentId"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany("Roles") - .HasForeignKey("OrganizationUnitId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("UserClaims") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Scopes") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) - .WithMany("UserClaims") - .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Secrets") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("Claims") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedCorsOrigins") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedGrantTypes") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("IdentityProviderRestrictions") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("PostLogoutRedirectUris") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("Properties") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("RedirectUris") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedScopes") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("ClientSecrets") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) - .WithMany("UserClaims") - .HasForeignKey("IdentityResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.HasOne("Volo.Abp.TenantManagement.Tenant", null) - .WithMany("ConnectionStrings") - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200710064926_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200710064926_Initial.cs deleted file mode 100644 index 2c82babc5b..0000000000 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200710064926_Initial.cs +++ /dev/null @@ -1,1235 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MyCompanyName.MyProjectName.Migrations -{ - public partial class Initial : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AbpAuditLogs", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantId = table.Column(nullable: true), - TenantName = table.Column(nullable: true), - ImpersonatorUserId = table.Column(nullable: true), - ImpersonatorTenantId = table.Column(nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - ClientName = table.Column(maxLength: 128, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - HttpMethod = table.Column(maxLength: 16, nullable: true), - Url = table.Column(maxLength: 256, nullable: true), - Exceptions = table.Column(maxLength: 4000, nullable: true), - Comments = table.Column(maxLength: 256, nullable: true), - HttpStatusCode = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpBackgroundJobs", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - JobName = table.Column(maxLength: 128, nullable: false), - JobArgs = table.Column(maxLength: 1048576, nullable: false), - TryCount = table.Column(nullable: false, defaultValue: (short)0), - CreationTime = table.Column(nullable: false), - NextTryTime = table.Column(nullable: false), - LastTryTime = table.Column(nullable: true), - IsAbandoned = table.Column(nullable: false, defaultValue: false), - Priority = table.Column(nullable: false, defaultValue: (byte)15) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpClaimTypes", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - Name = table.Column(maxLength: 256, nullable: false), - Required = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - Regex = table.Column(maxLength: 512, nullable: true), - RegexDescription = table.Column(maxLength: 128, nullable: true), - Description = table.Column(maxLength: 256, nullable: true), - ValueType = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpFeatureValues", - columns: table => new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpFeatureValues", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpOrganizationUnits", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - TenantId = table.Column(nullable: true), - ParentId = table.Column(nullable: true), - Code = table.Column(maxLength: 95, nullable: false), - DisplayName = table.Column(maxLength: 128, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id); - table.ForeignKey( - name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", - column: x => x.ParentId, - principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "AbpPermissionGrants", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: false), - ProviderKey = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpRoles", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 256, nullable: false), - NormalizedName = table.Column(maxLength: 256, nullable: false), - IsDefault = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - IsPublic = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpSecurityLogs", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - TenantId = table.Column(nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - Identity = table.Column(maxLength: 96, nullable: true), - Action = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantName = table.Column(maxLength: 64, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - CreationTime = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpSettings", - columns: table => new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 2048, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpSettings", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpTenants", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpTenants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpUsers", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - TenantId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: false), - NormalizedUserName = table.Column(maxLength: 256, nullable: false), - Name = table.Column(maxLength: 64, nullable: true), - Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: false), - NormalizedEmail = table.Column(maxLength: 256, nullable: false), - EmailConfirmed = table.Column(nullable: false, defaultValue: false), - PasswordHash = table.Column(maxLength: 256, nullable: true), - SecurityStamp = table.Column(maxLength: 256, nullable: false), - PhoneNumber = table.Column(maxLength: 16, nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false, defaultValue: false), - TwoFactorEnabled = table.Column(nullable: false, defaultValue: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false, defaultValue: false), - AccessFailedCount = table.Column(nullable: false, defaultValue: 0) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiResources", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Properties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClients", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - ClientName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 2000, nullable: true), - LogoUri = table.Column(maxLength: 2000, nullable: true), - Enabled = table.Column(nullable: false), - ProtocolType = table.Column(maxLength: 200, nullable: false), - RequireClientSecret = table.Column(nullable: false), - RequireConsent = table.Column(nullable: false), - AllowRememberConsent = table.Column(nullable: false), - AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), - RequirePkce = table.Column(nullable: false), - AllowPlainTextPkce = table.Column(nullable: false), - AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - BackChannelLogoutSessionRequired = table.Column(nullable: false), - AllowOfflineAccess = table.Column(nullable: false), - IdentityTokenLifetime = table.Column(nullable: false), - AccessTokenLifetime = table.Column(nullable: false), - AuthorizationCodeLifetime = table.Column(nullable: false), - ConsentLifetime = table.Column(nullable: true), - AbsoluteRefreshTokenLifetime = table.Column(nullable: false), - SlidingRefreshTokenLifetime = table.Column(nullable: false), - RefreshTokenUsage = table.Column(nullable: false), - UpdateAccessTokenClaimsOnRefresh = table.Column(nullable: false), - RefreshTokenExpiration = table.Column(nullable: false), - AccessTokenType = table.Column(nullable: false), - EnableLocalLogin = table.Column(nullable: false), - IncludeJwtId = table.Column(nullable: false), - AlwaysSendClientClaims = table.Column(nullable: false), - ClientClaimsPrefix = table.Column(maxLength: 200, nullable: true), - PairWiseSubjectSalt = table.Column(maxLength: 200, nullable: true), - UserSsoLifetime = table.Column(nullable: true), - UserCodeType = table.Column(maxLength: 100, nullable: true), - DeviceCodeLifetime = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClients", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerDeviceFlowCodes", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - DeviceCode = table.Column(maxLength: 200, nullable: false), - UserCode = table.Column(maxLength: 200, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - Expiration = table.Column(nullable: false), - Data = table.Column(maxLength: 50000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerIdentityResources", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false), - Properties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerPersistedGrants", - columns: table => new - { - Key = table.Column(maxLength: 200, nullable: false), - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - Type = table.Column(maxLength: 50, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: true), - Data = table.Column(maxLength: 50000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); - }); - - migrationBuilder.CreateTable( - name: "AbpAuditLogActions", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - AuditLogId = table.Column(nullable: false), - ServiceName = table.Column(maxLength: 256, nullable: true), - MethodName = table.Column(maxLength: 128, nullable: true), - Parameters = table.Column(maxLength: 2000, nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); - table.ForeignKey( - name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", - column: x => x.AuditLogId, - principalTable: "AbpAuditLogs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpEntityChanges", - columns: table => new - { - Id = table.Column(nullable: false), - AuditLogId = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ChangeTime = table.Column(nullable: false), - ChangeType = table.Column(nullable: false), - EntityTenantId = table.Column(nullable: true), - EntityId = table.Column(maxLength: 128, nullable: false), - EntityTypeFullName = table.Column(maxLength: 128, nullable: false), - ExtraProperties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); - table.ForeignKey( - name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", - column: x => x.AuditLogId, - principalTable: "AbpAuditLogs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpOrganizationUnitRoles", - columns: table => new - { - RoleId = table.Column(nullable: false), - OrganizationUnitId = table.Column(nullable: false), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - TenantId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpOrganizationUnitRoles", x => new { x.OrganizationUnitId, x.RoleId }); - table.ForeignKey( - name: "FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUnitId", - column: x => x.OrganizationUnitId, - principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AbpOrganizationUnitRoles_AbpRoles_RoleId", - column: x => x.RoleId, - principalTable: "AbpRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpRoleClaims", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - RoleId = table.Column(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: "AbpTenantConnectionStrings", - columns: table => new - { - TenantId = table.Column(nullable: false), - Name = table.Column(maxLength: 64, nullable: false), - Value = table.Column(maxLength: 1024, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); - table.ForeignKey( - name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", - column: x => x.TenantId, - principalTable: "AbpTenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserClaims", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - UserId = table.Column(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 - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - TenantId = table.Column(nullable: true), - ProviderKey = table.Column(maxLength: 196, nullable: false), - ProviderDisplayName = table.Column(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: "AbpUserOrganizationUnits", - columns: table => new - { - UserId = table.Column(nullable: false), - OrganizationUnitId = table.Column(nullable: false), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - TenantId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserOrganizationUnits", x => new { x.OrganizationUnitId, x.UserId }); - table.ForeignKey( - name: "FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUnitId", - column: x => x.OrganizationUnitId, - principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AbpUserOrganizationUnits_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserRoles", - columns: table => new - { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false), - TenantId = table.Column(nullable: true) - }, - 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 - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - TenantId = table.Column(nullable: true), - Value = table.Column(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 - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiClaims", x => new { x.ApiResourceId, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiClaims_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiScopes", - columns: table => new - { - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopes", x => new { x.ApiResourceId, x.Name }); - table.ForeignKey( - name: "FK_IdentityServerApiScopes_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiSecrets", - columns: table => new - { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerApiSecrets_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientClaims", - columns: table => new - { - ClientId = table.Column(nullable: false), - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 250, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientCorsOrigins", - columns: table => new - { - ClientId = table.Column(nullable: false), - Origin = table.Column(maxLength: 150, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin }); - table.ForeignKey( - name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientGrantTypes", - columns: table => new - { - ClientId = table.Column(nullable: false), - GrantType = table.Column(maxLength: 250, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType }); - table.ForeignKey( - name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientIdPRestrictions", - columns: table => new - { - ClientId = table.Column(nullable: false), - Provider = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider }); - table.ForeignKey( - name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientPostLogoutRedirectUris", - columns: table => new - { - ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri }); - table.ForeignKey( - name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientProperties", - columns: table => new - { - ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key }); - table.ForeignKey( - name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientRedirectUris", - columns: table => new - { - ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri }); - table.ForeignKey( - name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientScopes", - columns: table => new - { - ClientId = table.Column(nullable: false), - Scope = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope }); - table.ForeignKey( - name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientSecrets", - columns: table => new - { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerIdentityClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - IdentityResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerIdentityClaims", x => new { x.IdentityResourceId, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerIdentityClaims_IdentityServerIdentityResources_IdentityResourceId", - column: x => x.IdentityResourceId, - principalTable: "IdentityServerIdentityResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpEntityPropertyChanges", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - EntityChangeId = table.Column(nullable: false), - NewValue = table.Column(maxLength: 512, nullable: true), - OriginalValue = table.Column(maxLength: 512, nullable: true), - PropertyName = table.Column(maxLength: 128, nullable: false), - PropertyTypeFullName = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); - table.ForeignKey( - name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", - column: x => x.EntityChangeId, - principalTable: "AbpEntityChanges", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiScopeClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiResourceId, x.Name, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiResourceId_Name", - columns: x => new { x.ApiResourceId, x.Name }, - principalTable: "IdentityServerApiScopes", - principalColumns: new[] { "ApiResourceId", "Name" }, - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogActions_AuditLogId", - table: "AbpAuditLogActions", - column: "AuditLogId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", - table: "AbpAuditLogActions", - columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogs_TenantId_ExecutionTime", - table: "AbpAuditLogs", - columns: new[] { "TenantId", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", - table: "AbpAuditLogs", - columns: new[] { "TenantId", "UserId", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", - table: "AbpBackgroundJobs", - columns: new[] { "IsAbandoned", "NextTryTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityChanges_AuditLogId", - table: "AbpEntityChanges", - column: "AuditLogId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", - table: "AbpEntityChanges", - columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityPropertyChanges_EntityChangeId", - table: "AbpEntityPropertyChanges", - column: "EntityChangeId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", - table: "AbpFeatureValues", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", - table: "AbpOrganizationUnitRoles", - columns: new[] { "RoleId", "OrganizationUnitId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpOrganizationUnits_Code", - table: "AbpOrganizationUnits", - column: "Code"); - - migrationBuilder.CreateIndex( - name: "IX_AbpOrganizationUnits_ParentId", - table: "AbpOrganizationUnits", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", - table: "AbpPermissionGrants", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpRoleClaims_RoleId", - table: "AbpRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpRoles_NormalizedName", - table: "AbpRoles", - column: "NormalizedName"); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_Action", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "Action" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_ApplicationName", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "ApplicationName" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_Identity", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "Identity" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_UserId", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "UserId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSettings_Name_ProviderName_ProviderKey", - table: "AbpSettings", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpTenants_Name", - table: "AbpTenants", - column: "Name"); - - 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_AbpUserOrganizationUnits_UserId_OrganizationUnitId", - table: "AbpUserOrganizationUnits", - columns: new[] { "UserId", "OrganizationUnitId" }); - - 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_IdentityServerClients_ClientId", - table: "IdentityServerClients", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", - table: "IdentityServerDeviceFlowCodes", - column: "DeviceCode", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerDeviceFlowCodes_Expiration", - table: "IdentityServerDeviceFlowCodes", - column: "Expiration"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerDeviceFlowCodes_UserCode", - table: "IdentityServerDeviceFlowCodes", - column: "UserCode", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerPersistedGrants_Expiration", - table: "IdentityServerPersistedGrants", - column: "Expiration"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", - table: "IdentityServerPersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type" }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AbpAuditLogActions"); - - migrationBuilder.DropTable( - name: "AbpBackgroundJobs"); - - migrationBuilder.DropTable( - name: "AbpClaimTypes"); - - migrationBuilder.DropTable( - name: "AbpEntityPropertyChanges"); - - migrationBuilder.DropTable( - name: "AbpFeatureValues"); - - migrationBuilder.DropTable( - name: "AbpOrganizationUnitRoles"); - - migrationBuilder.DropTable( - name: "AbpPermissionGrants"); - - migrationBuilder.DropTable( - name: "AbpRoleClaims"); - - migrationBuilder.DropTable( - name: "AbpSecurityLogs"); - - migrationBuilder.DropTable( - name: "AbpSettings"); - - migrationBuilder.DropTable( - name: "AbpTenantConnectionStrings"); - - migrationBuilder.DropTable( - name: "AbpUserClaims"); - - migrationBuilder.DropTable( - name: "AbpUserLogins"); - - migrationBuilder.DropTable( - name: "AbpUserOrganizationUnits"); - - migrationBuilder.DropTable( - name: "AbpUserRoles"); - - migrationBuilder.DropTable( - name: "AbpUserTokens"); - - migrationBuilder.DropTable( - name: "IdentityServerApiClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerApiScopeClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerApiSecrets"); - - migrationBuilder.DropTable( - name: "IdentityServerClientClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerClientCorsOrigins"); - - migrationBuilder.DropTable( - name: "IdentityServerClientGrantTypes"); - - migrationBuilder.DropTable( - name: "IdentityServerClientIdPRestrictions"); - - migrationBuilder.DropTable( - name: "IdentityServerClientPostLogoutRedirectUris"); - - migrationBuilder.DropTable( - name: "IdentityServerClientProperties"); - - migrationBuilder.DropTable( - name: "IdentityServerClientRedirectUris"); - - migrationBuilder.DropTable( - name: "IdentityServerClientScopes"); - - migrationBuilder.DropTable( - name: "IdentityServerClientSecrets"); - - migrationBuilder.DropTable( - name: "IdentityServerDeviceFlowCodes"); - - migrationBuilder.DropTable( - name: "IdentityServerIdentityClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerPersistedGrants"); - - migrationBuilder.DropTable( - name: "AbpEntityChanges"); - - migrationBuilder.DropTable( - name: "AbpTenants"); - - migrationBuilder.DropTable( - name: "AbpOrganizationUnits"); - - migrationBuilder.DropTable( - name: "AbpRoles"); - - migrationBuilder.DropTable( - name: "AbpUsers"); - - migrationBuilder.DropTable( - name: "IdentityServerApiScopes"); - - migrationBuilder.DropTable( - name: "IdentityServerClients"); - - migrationBuilder.DropTable( - name: "IdentityServerIdentityResources"); - - migrationBuilder.DropTable( - name: "AbpAuditLogs"); - - migrationBuilder.DropTable( - name: "IdentityServerApiResources"); - } - } -} diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200730102617_Initial.Designer.cs similarity index 91% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200730102617_Initial.Designer.cs index 59e4e386ff..780d19f859 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200730102617_Initial.Designer.cs @@ -10,8 +10,8 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { - [DbContext(typeof(IdentityServerHostMigrationsDbContext))] - [Migration("20200707075532_Initial")] + [DbContext(typeof(MyProjectNameMigrationsDbContext))] + [Migration("20200730102617_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -275,6 +275,95 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpEntityPropertyChanges"); }); + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(40)") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(1048576); + + b.Property("JobName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("LastTryTime") + .HasColumnType("datetime2"); + + b.Property("NextTryTime") + .HasColumnType("datetime2"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") @@ -399,6 +488,81 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpRoleClaims"); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasColumnType("nvarchar(96)") + .HasMaxLength(96); + + b.Property("ApplicationName") + .HasColumnType("nvarchar(96)") + .HasMaxLength(96); + + b.Property("BrowserInfo") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("ClientId") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ClientIpAddress") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(40)") + .HasMaxLength(40); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("Identity") + .HasColumnType("nvarchar(96)") + .HasMaxLength(96); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") @@ -774,25 +938,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpOrganizationUnitRoles"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ApiResourceId", "Key", "Value"); - - b.ToTable("IdentityServerApiResourceProperties"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResource", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -869,7 +1015,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResources"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -883,7 +1029,25 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResourceClaims"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -897,7 +1061,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResourceScopes"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -1866,36 +2030,36 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) - .WithMany("Properties") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) - .WithMany("UserClaims") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Properties") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200730102617_Initial.cs similarity index 92% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200730102617_Initial.cs index 2ee3b628fb..690275f181 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200707075532_Initial.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200730102617_Initial.cs @@ -39,6 +39,27 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpBackgroundJobs", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + JobName = table.Column(maxLength: 128, nullable: false), + JobArgs = table.Column(maxLength: 1048576, nullable: false), + TryCount = table.Column(nullable: false, defaultValue: (short)0), + CreationTime = table.Column(nullable: false), + NextTryTime = table.Column(nullable: false), + LastTryTime = table.Column(nullable: true), + IsAbandoned = table.Column(nullable: false, defaultValue: false), + Priority = table.Column(nullable: false, defaultValue: (byte)15) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpClaimTypes", columns: table => new @@ -59,6 +80,21 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpFeatureValues", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + Value = table.Column(maxLength: 128, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: true), + ProviderKey = table.Column(maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpFeatureValues", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpOrganizationUnits", columns: table => new @@ -123,6 +159,31 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpRoles", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpSecurityLogs", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + TenantId = table.Column(nullable: true), + ApplicationName = table.Column(maxLength: 96, nullable: true), + Identity = table.Column(maxLength: 96, nullable: true), + Action = table.Column(maxLength: 96, nullable: true), + UserId = table.Column(nullable: true), + UserName = table.Column(maxLength: 256, nullable: true), + TenantName = table.Column(maxLength: 64, nullable: true), + ClientId = table.Column(maxLength: 64, nullable: true), + CorrelationId = table.Column(maxLength: 64, nullable: true), + ClientIpAddress = table.Column(maxLength: 64, nullable: true), + BrowserInfo = table.Column(maxLength: 512, nullable: true), + CreationTime = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpSettings", columns: table => new @@ -972,6 +1033,11 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpAuditLogs", columns: new[] { "TenantId", "UserId", "ExecutionTime" }); + migrationBuilder.CreateIndex( + name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", + table: "AbpBackgroundJobs", + columns: new[] { "IsAbandoned", "NextTryTime" }); + migrationBuilder.CreateIndex( name: "IX_AbpEntityChanges_AuditLogId", table: "AbpEntityChanges", @@ -987,6 +1053,11 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpEntityPropertyChanges", column: "EntityChangeId"); + migrationBuilder.CreateIndex( + name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", + table: "AbpFeatureValues", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + migrationBuilder.CreateIndex( name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", table: "AbpOrganizationUnitRoles", @@ -1017,6 +1088,26 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpRoles", column: "NormalizedName"); + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_Action", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "Action" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_ApplicationName", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "ApplicationName" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_Identity", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "Identity" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_UserId", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "UserId" }); + migrationBuilder.CreateIndex( name: "IX_AbpSettings_Name_ProviderName_ProviderKey", table: "AbpSettings", @@ -1127,12 +1218,18 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpAuditLogActions"); + migrationBuilder.DropTable( + name: "AbpBackgroundJobs"); + migrationBuilder.DropTable( name: "AbpClaimTypes"); migrationBuilder.DropTable( name: "AbpEntityPropertyChanges"); + migrationBuilder.DropTable( + name: "AbpFeatureValues"); + migrationBuilder.DropTable( name: "AbpOrganizationUnitRoles"); @@ -1142,6 +1239,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpRoleClaims"); + migrationBuilder.DropTable( + name: "AbpSecurityLogs"); + migrationBuilder.DropTable( name: "AbpSettings"); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs index 26286c9be6..34c4149b92 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs @@ -936,25 +936,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpOrganizationUnitRoles"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ApiResourceId", "Key", "Value"); - - b.ToTable("IdentityServerApiResourceProperties"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResource", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1031,7 +1013,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResources"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -1045,7 +1027,25 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResourceClaims"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -1059,7 +1059,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResourceScopes"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -2028,36 +2028,36 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) - .WithMany("Properties") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) - .WithMany("UserClaims") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Properties") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200710065039_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200710065039_Initial.Designer.cs deleted file mode 100644 index 00033c31b9..0000000000 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200710065039_Initial.Designer.cs +++ /dev/null @@ -1,1936 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyCompanyName.MyProjectName.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore; - -namespace MyCompanyName.MyProjectName.Migrations -{ - [DbContext(typeof(IdentityServerHostMigrationsDbContext))] - [Migration("20200710065039_Initial")] - partial class Initial - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "3.1.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ApplicationName") - .HasColumnName("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); - - b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("ClientId") - .HasColumnName("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ClientName") - .HasColumnName("ClientName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Comments") - .HasColumnName("Comments") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CorrelationId") - .HasColumnName("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Exceptions") - .HasColumnName("Exceptions") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); - - b.Property("ExecutionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("HttpMethod") - .HasColumnName("HttpMethod") - .HasColumnType("nvarchar(16)") - .HasMaxLength(16); - - b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); - - b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantName") - .HasColumnType("nvarchar(max)"); - - b.Property("Url") - .HasColumnName("Url") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserName") - .HasColumnName("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ExecutionTime"); - - b.HasIndex("TenantId", "UserId", "ExecutionTime"); - - b.ToTable("AbpAuditLogs"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); - - b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); - - b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("MethodName") - .HasColumnName("MethodName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Parameters") - .HasColumnName("Parameters") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ServiceName") - .HasColumnName("ServiceName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - - b.ToTable("AbpAuditLogActions"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); - - b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); - - b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); - - b.Property("EntityId") - .IsRequired() - .HasColumnName("EntityId") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("EntityTenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("EntityTypeFullName") - .IsRequired() - .HasColumnName("EntityTypeFullName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - - b.ToTable("AbpEntityChanges"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("EntityChangeId") - .HasColumnType("uniqueidentifier"); - - b.Property("NewValue") - .HasColumnName("NewValue") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("OriginalValue") - .HasColumnName("OriginalValue") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("PropertyName") - .IsRequired() - .HasColumnName("PropertyName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("PropertyTypeFullName") - .IsRequired() - .HasColumnName("PropertyTypeFullName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("EntityChangeId"); - - b.ToTable("AbpEntityPropertyChanges"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsStatic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("Regex") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("RegexDescription") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ValueType") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("AbpClaimTypes"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDefault") - .HasColumnName("IsDefault") - .HasColumnType("bit"); - - b.Property("IsPublic") - .HasColumnName("IsPublic") - .HasColumnType("bit"); - - b.Property("IsStatic") - .HasColumnName("IsStatic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("NormalizedName") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName"); - - b.ToTable("AbpRoles"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ClaimType") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AbpRoleClaims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Action") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); - - b.Property("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); - - b.Property("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("CreationTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("Identity") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Action"); - - b.HasIndex("TenantId", "ApplicationName"); - - b.HasIndex("TenantId", "Identity"); - - b.HasIndex("TenantId", "UserId"); - - b.ToTable("AbpSecurityLogs"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .ValueGeneratedOnAdd() - .HasColumnName("AccessFailedCount") - .HasColumnType("int") - .HasDefaultValue(0); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnName("Email") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("EmailConfirmed") - .ValueGeneratedOnAdd() - .HasColumnName("EmailConfirmed") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("LockoutEnabled") - .ValueGeneratedOnAdd() - .HasColumnName("LockoutEnabled") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("Name") - .HasColumnName("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("NormalizedEmail") - .IsRequired() - .HasColumnName("NormalizedEmail") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("NormalizedUserName") - .IsRequired() - .HasColumnName("NormalizedUserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("PasswordHash") - .HasColumnName("PasswordHash") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("PhoneNumber") - .HasColumnName("PhoneNumber") - .HasColumnType("nvarchar(16)") - .HasMaxLength(16); - - b.Property("PhoneNumberConfirmed") - .ValueGeneratedOnAdd() - .HasColumnName("PhoneNumberConfirmed") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("SecurityStamp") - .IsRequired() - .HasColumnName("SecurityStamp") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("Surname") - .HasColumnName("Surname") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("TwoFactorEnabled") - .ValueGeneratedOnAdd() - .HasColumnName("TwoFactorEnabled") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("UserName") - .IsRequired() - .HasColumnName("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("Email"); - - b.HasIndex("NormalizedEmail"); - - b.HasIndex("NormalizedUserName"); - - b.HasIndex("UserName"); - - b.ToTable("AbpUsers"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ClaimType") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AbpUserClaims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "LoginProvider"); - - b.HasIndex("LoginProvider", "ProviderKey"); - - b.ToTable("AbpUserLogins"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => - { - b.Property("OrganizationUnitId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("OrganizationUnitId", "UserId"); - - b.HasIndex("UserId", "OrganizationUnitId"); - - b.ToTable("AbpUserOrganizationUnits"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId", "UserId"); - - b.ToTable("AbpUserRoles"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Name") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AbpUserTokens"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnName("Code") - .HasColumnType("nvarchar(95)") - .HasMaxLength(95); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("DisplayName") - .IsRequired() - .HasColumnName("DisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("Code"); - - b.HasIndex("ParentId"); - - b.ToTable("AbpOrganizationUnits"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => - { - b.Property("OrganizationUnitId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("OrganizationUnitId", "RoleId"); - - b.HasIndex("RoleId", "OrganizationUnitId"); - - b.ToTable("AbpOrganizationUnitRoles"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("IdentityServerApiResources"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ApiResourceId", "Type"); - - b.ToTable("IdentityServerApiClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Emphasize") - .HasColumnType("bit"); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ShowInDiscoveryDocument") - .HasColumnType("bit"); - - b.HasKey("ApiResourceId", "Name"); - - b.ToTable("IdentityServerApiScopes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ApiResourceId", "Name", "Type"); - - b.ToTable("IdentityServerApiScopeClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.HasKey("ApiResourceId", "Type", "Value"); - - b.ToTable("IdentityServerApiSecrets"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AbsoluteRefreshTokenLifetime") - .HasColumnType("int"); - - b.Property("AccessTokenLifetime") - .HasColumnType("int"); - - b.Property("AccessTokenType") - .HasColumnType("int"); - - b.Property("AllowAccessTokensViaBrowser") - .HasColumnType("bit"); - - b.Property("AllowOfflineAccess") - .HasColumnType("bit"); - - b.Property("AllowPlainTextPkce") - .HasColumnType("bit"); - - b.Property("AllowRememberConsent") - .HasColumnType("bit"); - - b.Property("AlwaysIncludeUserClaimsInIdToken") - .HasColumnType("bit"); - - b.Property("AlwaysSendClientClaims") - .HasColumnType("bit"); - - b.Property("AuthorizationCodeLifetime") - .HasColumnType("int"); - - b.Property("BackChannelLogoutSessionRequired") - .HasColumnType("bit"); - - b.Property("BackChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ClientClaimsPrefix") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("ConsentLifetime") - .HasColumnType("int"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DeviceCodeLifetime") - .HasColumnType("int"); - - b.Property("EnableLocalLogin") - .HasColumnType("bit"); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("FrontChannelLogoutSessionRequired") - .HasColumnType("bit"); - - b.Property("FrontChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("IdentityTokenLifetime") - .HasColumnType("int"); - - b.Property("IncludeJwtId") - .HasColumnType("bit"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("LogoUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("PairWiseSubjectSalt") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ProtocolType") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("RefreshTokenExpiration") - .HasColumnType("int"); - - b.Property("RefreshTokenUsage") - .HasColumnType("int"); - - b.Property("RequireClientSecret") - .HasColumnType("bit"); - - b.Property("RequireConsent") - .HasColumnType("bit"); - - b.Property("RequirePkce") - .HasColumnType("bit"); - - b.Property("SlidingRefreshTokenLifetime") - .HasColumnType("int"); - - b.Property("UpdateAccessTokenClaimsOnRefresh") - .HasColumnType("bit"); - - b.Property("UserCodeType") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); - - b.Property("UserSsoLifetime") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.ToTable("IdentityServerClients"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.HasKey("ClientId", "Type", "Value"); - - b.ToTable("IdentityServerClientClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Origin") - .HasColumnType("nvarchar(150)") - .HasMaxLength(150); - - b.HasKey("ClientId", "Origin"); - - b.ToTable("IdentityServerClientCorsOrigins"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("GrantType") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.HasKey("ClientId", "GrantType"); - - b.ToTable("IdentityServerClientGrantTypes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Provider") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ClientId", "Provider"); - - b.ToTable("IdentityServerClientIdPRestrictions"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("PostLogoutRedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "PostLogoutRedirectUri"); - - b.ToTable("IdentityServerClientPostLogoutRedirectUris"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "Key"); - - b.ToTable("IdentityServerClientProperties"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("RedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "RedirectUri"); - - b.ToTable("IdentityServerClientRedirectUris"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ClientId", "Scope"); - - b.ToTable("IdentityServerClientScopes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.HasKey("ClientId", "Type", "Value"); - - b.ToTable("IdentityServerClientSecrets"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Data") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); - - b.Property("DeviceCode") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Expiration") - .IsRequired() - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("UserCode") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("Id"); - - b.HasIndex("DeviceCode") - .IsUnique(); - - b.HasIndex("Expiration"); - - b.HasIndex("UserCode") - .IsUnique(); - - b.ToTable("IdentityServerDeviceFlowCodes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => - { - b.Property("Key") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(50)") - .HasMaxLength(50); - - b.HasKey("Key"); - - b.HasIndex("Expiration"); - - b.HasIndex("SubjectId", "ClientId", "Type"); - - b.ToTable("IdentityServerPersistedGrants"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => - { - b.Property("IdentityResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("IdentityResourceId", "Type"); - - b.ToTable("IdentityServerIdentityClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Emphasize") - .HasColumnType("bit"); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ShowInDiscoveryDocument") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("IdentityServerIdentityResources"); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpPermissionGrants"); - }); - - modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpSettings"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("AbpTenants"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.HasKey("TenantId", "Name"); - - b.ToTable("AbpTenantConnectionStrings"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("Actions") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("EntityChanges") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) - .WithMany("PropertyChanges") - .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany("Claims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Claims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany() - .HasForeignKey("OrganizationUnitId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("OrganizationUnits") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Roles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany() - .HasForeignKey("ParentId"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany("Roles") - .HasForeignKey("OrganizationUnitId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("UserClaims") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Scopes") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) - .WithMany("UserClaims") - .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Secrets") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("Claims") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedCorsOrigins") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedGrantTypes") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("IdentityProviderRestrictions") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("PostLogoutRedirectUris") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("Properties") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("RedirectUris") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedScopes") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("ClientSecrets") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) - .WithMany("UserClaims") - .HasForeignKey("IdentityResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.HasOne("Volo.Abp.TenantManagement.Tenant", null) - .WithMany("ConnectionStrings") - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200710065039_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200710065039_Initial.cs deleted file mode 100644 index f80a5d9936..0000000000 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200710065039_Initial.cs +++ /dev/null @@ -1,1183 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MyCompanyName.MyProjectName.Migrations -{ - public partial class Initial : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AbpAuditLogs", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantId = table.Column(nullable: true), - TenantName = table.Column(nullable: true), - ImpersonatorUserId = table.Column(nullable: true), - ImpersonatorTenantId = table.Column(nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - ClientName = table.Column(maxLength: 128, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - HttpMethod = table.Column(maxLength: 16, nullable: true), - Url = table.Column(maxLength: 256, nullable: true), - Exceptions = table.Column(maxLength: 4000, nullable: true), - Comments = table.Column(maxLength: 256, nullable: true), - HttpStatusCode = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpClaimTypes", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - Name = table.Column(maxLength: 256, nullable: false), - Required = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - Regex = table.Column(maxLength: 512, nullable: true), - RegexDescription = table.Column(maxLength: 128, nullable: true), - Description = table.Column(maxLength: 256, nullable: true), - ValueType = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpOrganizationUnits", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - TenantId = table.Column(nullable: true), - ParentId = table.Column(nullable: true), - Code = table.Column(maxLength: 95, nullable: false), - DisplayName = table.Column(maxLength: 128, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id); - table.ForeignKey( - name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", - column: x => x.ParentId, - principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "AbpPermissionGrants", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: false), - ProviderKey = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpRoles", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 256, nullable: false), - NormalizedName = table.Column(maxLength: 256, nullable: false), - IsDefault = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - IsPublic = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpSecurityLogs", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - TenantId = table.Column(nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - Identity = table.Column(maxLength: 96, nullable: true), - Action = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantName = table.Column(maxLength: 64, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - CreationTime = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpSettings", - columns: table => new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 2048, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpSettings", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpTenants", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpTenants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpUsers", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - TenantId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: false), - NormalizedUserName = table.Column(maxLength: 256, nullable: false), - Name = table.Column(maxLength: 64, nullable: true), - Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: false), - NormalizedEmail = table.Column(maxLength: 256, nullable: false), - EmailConfirmed = table.Column(nullable: false, defaultValue: false), - PasswordHash = table.Column(maxLength: 256, nullable: true), - SecurityStamp = table.Column(maxLength: 256, nullable: false), - PhoneNumber = table.Column(maxLength: 16, nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false, defaultValue: false), - TwoFactorEnabled = table.Column(nullable: false, defaultValue: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false, defaultValue: false), - AccessFailedCount = table.Column(nullable: false, defaultValue: 0) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiResources", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Properties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClients", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - ClientName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 2000, nullable: true), - LogoUri = table.Column(maxLength: 2000, nullable: true), - Enabled = table.Column(nullable: false), - ProtocolType = table.Column(maxLength: 200, nullable: false), - RequireClientSecret = table.Column(nullable: false), - RequireConsent = table.Column(nullable: false), - AllowRememberConsent = table.Column(nullable: false), - AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), - RequirePkce = table.Column(nullable: false), - AllowPlainTextPkce = table.Column(nullable: false), - AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - BackChannelLogoutSessionRequired = table.Column(nullable: false), - AllowOfflineAccess = table.Column(nullable: false), - IdentityTokenLifetime = table.Column(nullable: false), - AccessTokenLifetime = table.Column(nullable: false), - AuthorizationCodeLifetime = table.Column(nullable: false), - ConsentLifetime = table.Column(nullable: true), - AbsoluteRefreshTokenLifetime = table.Column(nullable: false), - SlidingRefreshTokenLifetime = table.Column(nullable: false), - RefreshTokenUsage = table.Column(nullable: false), - UpdateAccessTokenClaimsOnRefresh = table.Column(nullable: false), - RefreshTokenExpiration = table.Column(nullable: false), - AccessTokenType = table.Column(nullable: false), - EnableLocalLogin = table.Column(nullable: false), - IncludeJwtId = table.Column(nullable: false), - AlwaysSendClientClaims = table.Column(nullable: false), - ClientClaimsPrefix = table.Column(maxLength: 200, nullable: true), - PairWiseSubjectSalt = table.Column(maxLength: 200, nullable: true), - UserSsoLifetime = table.Column(nullable: true), - UserCodeType = table.Column(maxLength: 100, nullable: true), - DeviceCodeLifetime = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClients", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerDeviceFlowCodes", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - DeviceCode = table.Column(maxLength: 200, nullable: false), - UserCode = table.Column(maxLength: 200, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - Expiration = table.Column(nullable: false), - Data = table.Column(maxLength: 50000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerIdentityResources", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false), - Properties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerPersistedGrants", - columns: table => new - { - Key = table.Column(maxLength: 200, nullable: false), - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - Type = table.Column(maxLength: 50, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: true), - Data = table.Column(maxLength: 50000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); - }); - - migrationBuilder.CreateTable( - name: "AbpAuditLogActions", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - AuditLogId = table.Column(nullable: false), - ServiceName = table.Column(maxLength: 256, nullable: true), - MethodName = table.Column(maxLength: 128, nullable: true), - Parameters = table.Column(maxLength: 2000, nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); - table.ForeignKey( - name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", - column: x => x.AuditLogId, - principalTable: "AbpAuditLogs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpEntityChanges", - columns: table => new - { - Id = table.Column(nullable: false), - AuditLogId = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ChangeTime = table.Column(nullable: false), - ChangeType = table.Column(nullable: false), - EntityTenantId = table.Column(nullable: true), - EntityId = table.Column(maxLength: 128, nullable: false), - EntityTypeFullName = table.Column(maxLength: 128, nullable: false), - ExtraProperties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); - table.ForeignKey( - name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", - column: x => x.AuditLogId, - principalTable: "AbpAuditLogs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpOrganizationUnitRoles", - columns: table => new - { - RoleId = table.Column(nullable: false), - OrganizationUnitId = table.Column(nullable: false), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - TenantId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpOrganizationUnitRoles", x => new { x.OrganizationUnitId, x.RoleId }); - table.ForeignKey( - name: "FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUnitId", - column: x => x.OrganizationUnitId, - principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AbpOrganizationUnitRoles_AbpRoles_RoleId", - column: x => x.RoleId, - principalTable: "AbpRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpRoleClaims", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - RoleId = table.Column(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: "AbpTenantConnectionStrings", - columns: table => new - { - TenantId = table.Column(nullable: false), - Name = table.Column(maxLength: 64, nullable: false), - Value = table.Column(maxLength: 1024, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); - table.ForeignKey( - name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", - column: x => x.TenantId, - principalTable: "AbpTenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserClaims", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - UserId = table.Column(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 - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - TenantId = table.Column(nullable: true), - ProviderKey = table.Column(maxLength: 196, nullable: false), - ProviderDisplayName = table.Column(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: "AbpUserOrganizationUnits", - columns: table => new - { - UserId = table.Column(nullable: false), - OrganizationUnitId = table.Column(nullable: false), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - TenantId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserOrganizationUnits", x => new { x.OrganizationUnitId, x.UserId }); - table.ForeignKey( - name: "FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUnitId", - column: x => x.OrganizationUnitId, - principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AbpUserOrganizationUnits_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserRoles", - columns: table => new - { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false), - TenantId = table.Column(nullable: true) - }, - 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 - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - TenantId = table.Column(nullable: true), - Value = table.Column(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 - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiClaims", x => new { x.ApiResourceId, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiClaims_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiScopes", - columns: table => new - { - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopes", x => new { x.ApiResourceId, x.Name }); - table.ForeignKey( - name: "FK_IdentityServerApiScopes_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiSecrets", - columns: table => new - { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerApiSecrets_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientClaims", - columns: table => new - { - ClientId = table.Column(nullable: false), - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 250, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientCorsOrigins", - columns: table => new - { - ClientId = table.Column(nullable: false), - Origin = table.Column(maxLength: 150, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin }); - table.ForeignKey( - name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientGrantTypes", - columns: table => new - { - ClientId = table.Column(nullable: false), - GrantType = table.Column(maxLength: 250, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType }); - table.ForeignKey( - name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientIdPRestrictions", - columns: table => new - { - ClientId = table.Column(nullable: false), - Provider = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider }); - table.ForeignKey( - name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientPostLogoutRedirectUris", - columns: table => new - { - ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri }); - table.ForeignKey( - name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientProperties", - columns: table => new - { - ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key }); - table.ForeignKey( - name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientRedirectUris", - columns: table => new - { - ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri }); - table.ForeignKey( - name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientScopes", - columns: table => new - { - ClientId = table.Column(nullable: false), - Scope = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope }); - table.ForeignKey( - name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientSecrets", - columns: table => new - { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerIdentityClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - IdentityResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerIdentityClaims", x => new { x.IdentityResourceId, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerIdentityClaims_IdentityServerIdentityResources_IdentityResourceId", - column: x => x.IdentityResourceId, - principalTable: "IdentityServerIdentityResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpEntityPropertyChanges", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - EntityChangeId = table.Column(nullable: false), - NewValue = table.Column(maxLength: 512, nullable: true), - OriginalValue = table.Column(maxLength: 512, nullable: true), - PropertyName = table.Column(maxLength: 128, nullable: false), - PropertyTypeFullName = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); - table.ForeignKey( - name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", - column: x => x.EntityChangeId, - principalTable: "AbpEntityChanges", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiScopeClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiResourceId, x.Name, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiResourceId_Name", - columns: x => new { x.ApiResourceId, x.Name }, - principalTable: "IdentityServerApiScopes", - principalColumns: new[] { "ApiResourceId", "Name" }, - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogActions_AuditLogId", - table: "AbpAuditLogActions", - column: "AuditLogId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", - table: "AbpAuditLogActions", - columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogs_TenantId_ExecutionTime", - table: "AbpAuditLogs", - columns: new[] { "TenantId", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", - table: "AbpAuditLogs", - columns: new[] { "TenantId", "UserId", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityChanges_AuditLogId", - table: "AbpEntityChanges", - column: "AuditLogId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", - table: "AbpEntityChanges", - columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityPropertyChanges_EntityChangeId", - table: "AbpEntityPropertyChanges", - column: "EntityChangeId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", - table: "AbpOrganizationUnitRoles", - columns: new[] { "RoleId", "OrganizationUnitId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpOrganizationUnits_Code", - table: "AbpOrganizationUnits", - column: "Code"); - - migrationBuilder.CreateIndex( - name: "IX_AbpOrganizationUnits_ParentId", - table: "AbpOrganizationUnits", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", - table: "AbpPermissionGrants", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpRoleClaims_RoleId", - table: "AbpRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpRoles_NormalizedName", - table: "AbpRoles", - column: "NormalizedName"); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_Action", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "Action" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_ApplicationName", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "ApplicationName" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_Identity", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "Identity" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_UserId", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "UserId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSettings_Name_ProviderName_ProviderKey", - table: "AbpSettings", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpTenants_Name", - table: "AbpTenants", - column: "Name"); - - 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_AbpUserOrganizationUnits_UserId_OrganizationUnitId", - table: "AbpUserOrganizationUnits", - columns: new[] { "UserId", "OrganizationUnitId" }); - - 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_IdentityServerClients_ClientId", - table: "IdentityServerClients", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", - table: "IdentityServerDeviceFlowCodes", - column: "DeviceCode", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerDeviceFlowCodes_Expiration", - table: "IdentityServerDeviceFlowCodes", - column: "Expiration"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerDeviceFlowCodes_UserCode", - table: "IdentityServerDeviceFlowCodes", - column: "UserCode", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerPersistedGrants_Expiration", - table: "IdentityServerPersistedGrants", - column: "Expiration"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", - table: "IdentityServerPersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type" }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AbpAuditLogActions"); - - migrationBuilder.DropTable( - name: "AbpClaimTypes"); - - migrationBuilder.DropTable( - name: "AbpEntityPropertyChanges"); - - migrationBuilder.DropTable( - name: "AbpOrganizationUnitRoles"); - - migrationBuilder.DropTable( - name: "AbpPermissionGrants"); - - migrationBuilder.DropTable( - name: "AbpRoleClaims"); - - migrationBuilder.DropTable( - name: "AbpSecurityLogs"); - - migrationBuilder.DropTable( - name: "AbpSettings"); - - migrationBuilder.DropTable( - name: "AbpTenantConnectionStrings"); - - migrationBuilder.DropTable( - name: "AbpUserClaims"); - - migrationBuilder.DropTable( - name: "AbpUserLogins"); - - migrationBuilder.DropTable( - name: "AbpUserOrganizationUnits"); - - migrationBuilder.DropTable( - name: "AbpUserRoles"); - - migrationBuilder.DropTable( - name: "AbpUserTokens"); - - migrationBuilder.DropTable( - name: "IdentityServerApiClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerApiScopeClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerApiSecrets"); - - migrationBuilder.DropTable( - name: "IdentityServerClientClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerClientCorsOrigins"); - - migrationBuilder.DropTable( - name: "IdentityServerClientGrantTypes"); - - migrationBuilder.DropTable( - name: "IdentityServerClientIdPRestrictions"); - - migrationBuilder.DropTable( - name: "IdentityServerClientPostLogoutRedirectUris"); - - migrationBuilder.DropTable( - name: "IdentityServerClientProperties"); - - migrationBuilder.DropTable( - name: "IdentityServerClientRedirectUris"); - - migrationBuilder.DropTable( - name: "IdentityServerClientScopes"); - - migrationBuilder.DropTable( - name: "IdentityServerClientSecrets"); - - migrationBuilder.DropTable( - name: "IdentityServerDeviceFlowCodes"); - - migrationBuilder.DropTable( - name: "IdentityServerIdentityClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerPersistedGrants"); - - migrationBuilder.DropTable( - name: "AbpEntityChanges"); - - migrationBuilder.DropTable( - name: "AbpTenants"); - - migrationBuilder.DropTable( - name: "AbpOrganizationUnits"); - - migrationBuilder.DropTable( - name: "AbpRoles"); - - migrationBuilder.DropTable( - name: "AbpUsers"); - - migrationBuilder.DropTable( - name: "IdentityServerApiScopes"); - - migrationBuilder.DropTable( - name: "IdentityServerClients"); - - migrationBuilder.DropTable( - name: "IdentityServerIdentityResources"); - - migrationBuilder.DropTable( - name: "AbpAuditLogs"); - - migrationBuilder.DropTable( - name: "IdentityServerApiResources"); - } - } -} diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200730102718_Initial.Designer.cs similarity index 95% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200730102718_Initial.Designer.cs index fadec16eaf..c43c17df8b 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200730102718_Initial.Designer.cs @@ -10,8 +10,8 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { - [DbContext(typeof(MyProjectNameMigrationsDbContext))] - [Migration("20200707075540_Initial")] + [DbContext(typeof(IdentityServerHostMigrationsDbContext))] + [Migration("20200730102718_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -275,95 +275,6 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpEntityPropertyChanges"); }); - modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsAbandoned") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("JobArgs") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(1048576); - - b.Property("JobName") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("LastTryTime") - .HasColumnType("datetime2"); - - b.Property("NextTryTime") - .HasColumnType("datetime2"); - - b.Property("Priority") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint") - .HasDefaultValue((byte)15); - - b.Property("TryCount") - .ValueGeneratedOnAdd() - .HasColumnType("smallint") - .HasDefaultValue((short)0); - - b.HasKey("Id"); - - b.HasIndex("IsAbandoned", "NextTryTime"); - - b.ToTable("AbpBackgroundJobs"); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpFeatureValues"); - }); - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") @@ -488,6 +399,81 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpRoleClaims"); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasColumnType("nvarchar(96)") + .HasMaxLength(96); + + b.Property("ApplicationName") + .HasColumnType("nvarchar(96)") + .HasMaxLength(96); + + b.Property("BrowserInfo") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("ClientId") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ClientIpAddress") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(40)") + .HasMaxLength(40); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("Identity") + .HasColumnType("nvarchar(96)") + .HasMaxLength(96); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") @@ -863,25 +849,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpOrganizationUnitRoles"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ApiResourceId", "Key", "Value"); - - b.ToTable("IdentityServerApiResourceProperties"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResource", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -958,7 +926,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResources"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -972,7 +940,25 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResourceClaims"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -986,7 +972,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResourceScopes"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -1955,36 +1941,36 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) - .WithMany("Properties") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) - .WithMany("UserClaims") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Properties") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200730102718_Initial.cs similarity index 97% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200730102718_Initial.cs index 669982f451..a7a3b9786b 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200707075540_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200730102718_Initial.cs @@ -39,27 +39,6 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); }); - migrationBuilder.CreateTable( - name: "AbpBackgroundJobs", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - JobName = table.Column(maxLength: 128, nullable: false), - JobArgs = table.Column(maxLength: 1048576, nullable: false), - TryCount = table.Column(nullable: false, defaultValue: (short)0), - CreationTime = table.Column(nullable: false), - NextTryTime = table.Column(nullable: false), - LastTryTime = table.Column(nullable: true), - IsAbandoned = table.Column(nullable: false, defaultValue: false), - Priority = table.Column(nullable: false, defaultValue: (byte)15) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); - }); - migrationBuilder.CreateTable( name: "AbpClaimTypes", columns: table => new @@ -80,21 +59,6 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); }); - migrationBuilder.CreateTable( - name: "AbpFeatureValues", - columns: table => new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpFeatureValues", x => x.Id); - }); - migrationBuilder.CreateTable( name: "AbpOrganizationUnits", columns: table => new @@ -159,6 +123,31 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpRoles", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpSecurityLogs", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + TenantId = table.Column(nullable: true), + ApplicationName = table.Column(maxLength: 96, nullable: true), + Identity = table.Column(maxLength: 96, nullable: true), + Action = table.Column(maxLength: 96, nullable: true), + UserId = table.Column(nullable: true), + UserName = table.Column(maxLength: 256, nullable: true), + TenantName = table.Column(maxLength: 64, nullable: true), + ClientId = table.Column(maxLength: 64, nullable: true), + CorrelationId = table.Column(maxLength: 64, nullable: true), + ClientIpAddress = table.Column(maxLength: 64, nullable: true), + BrowserInfo = table.Column(maxLength: 512, nullable: true), + CreationTime = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpSettings", columns: table => new @@ -1008,11 +997,6 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpAuditLogs", columns: new[] { "TenantId", "UserId", "ExecutionTime" }); - migrationBuilder.CreateIndex( - name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", - table: "AbpBackgroundJobs", - columns: new[] { "IsAbandoned", "NextTryTime" }); - migrationBuilder.CreateIndex( name: "IX_AbpEntityChanges_AuditLogId", table: "AbpEntityChanges", @@ -1028,11 +1012,6 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpEntityPropertyChanges", column: "EntityChangeId"); - migrationBuilder.CreateIndex( - name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", - table: "AbpFeatureValues", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - migrationBuilder.CreateIndex( name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", table: "AbpOrganizationUnitRoles", @@ -1063,6 +1042,26 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpRoles", column: "NormalizedName"); + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_Action", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "Action" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_ApplicationName", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "ApplicationName" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_Identity", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "Identity" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_UserId", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "UserId" }); + migrationBuilder.CreateIndex( name: "IX_AbpSettings_Name_ProviderName_ProviderKey", table: "AbpSettings", @@ -1173,18 +1172,12 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpAuditLogActions"); - migrationBuilder.DropTable( - name: "AbpBackgroundJobs"); - migrationBuilder.DropTable( name: "AbpClaimTypes"); migrationBuilder.DropTable( name: "AbpEntityPropertyChanges"); - migrationBuilder.DropTable( - name: "AbpFeatureValues"); - migrationBuilder.DropTable( name: "AbpOrganizationUnitRoles"); @@ -1194,6 +1187,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpRoleClaims"); + migrationBuilder.DropTable( + name: "AbpSecurityLogs"); + migrationBuilder.DropTable( name: "AbpSettings"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs index 57cd4990f3..0f9ae2508f 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs @@ -847,25 +847,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpOrganizationUnitRoles"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ApiResourceId", "Key", "Value"); - - b.ToTable("IdentityServerApiResourceProperties"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResource", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -942,7 +924,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResources"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -956,7 +938,25 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResourceClaims"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -970,7 +970,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerApiResourceScopes"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); @@ -1939,36 +1939,36 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) - .WithMany("Properties") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) - .WithMany("UserClaims") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Properties") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiResourceSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiResource", null) + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200707075539_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200707075539_Initial.Designer.cs deleted file mode 100644 index ee1b9c6c25..0000000000 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200707075539_Initial.Designer.cs +++ /dev/null @@ -1,1043 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyCompanyName.MyProjectName.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore; - -namespace MyCompanyName.MyProjectName.Migrations -{ - [DbContext(typeof(UnifiedDbContext))] - [Migration("20200707075539_Initial")] - partial class Initial - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "3.1.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ApplicationName") - .HasColumnName("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); - - b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("ClientId") - .HasColumnName("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ClientName") - .HasColumnName("ClientName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Comments") - .HasColumnName("Comments") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CorrelationId") - .HasColumnName("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Exceptions") - .HasColumnName("Exceptions") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); - - b.Property("ExecutionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("HttpMethod") - .HasColumnName("HttpMethod") - .HasColumnType("nvarchar(16)") - .HasMaxLength(16); - - b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); - - b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantName") - .HasColumnType("nvarchar(max)"); - - b.Property("Url") - .HasColumnName("Url") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserName") - .HasColumnName("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ExecutionTime"); - - b.HasIndex("TenantId", "UserId", "ExecutionTime"); - - b.ToTable("AbpAuditLogs"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); - - b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); - - b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("MethodName") - .HasColumnName("MethodName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Parameters") - .HasColumnName("Parameters") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ServiceName") - .HasColumnName("ServiceName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - - b.ToTable("AbpAuditLogActions"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); - - b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); - - b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); - - b.Property("EntityId") - .IsRequired() - .HasColumnName("EntityId") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("EntityTenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("EntityTypeFullName") - .IsRequired() - .HasColumnName("EntityTypeFullName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - - b.ToTable("AbpEntityChanges"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("EntityChangeId") - .HasColumnType("uniqueidentifier"); - - b.Property("NewValue") - .HasColumnName("NewValue") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("OriginalValue") - .HasColumnName("OriginalValue") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("PropertyName") - .IsRequired() - .HasColumnName("PropertyName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("PropertyTypeFullName") - .IsRequired() - .HasColumnName("PropertyTypeFullName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("EntityChangeId"); - - b.ToTable("AbpEntityPropertyChanges"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsStatic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("Regex") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("RegexDescription") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ValueType") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("AbpClaimTypes"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDefault") - .HasColumnName("IsDefault") - .HasColumnType("bit"); - - b.Property("IsPublic") - .HasColumnName("IsPublic") - .HasColumnType("bit"); - - b.Property("IsStatic") - .HasColumnName("IsStatic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("NormalizedName") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName"); - - b.ToTable("AbpRoles"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ClaimType") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AbpRoleClaims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .ValueGeneratedOnAdd() - .HasColumnName("AccessFailedCount") - .HasColumnType("int") - .HasDefaultValue(0); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnName("Email") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("EmailConfirmed") - .ValueGeneratedOnAdd() - .HasColumnName("EmailConfirmed") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("LockoutEnabled") - .ValueGeneratedOnAdd() - .HasColumnName("LockoutEnabled") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("Name") - .HasColumnName("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("NormalizedEmail") - .IsRequired() - .HasColumnName("NormalizedEmail") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("NormalizedUserName") - .IsRequired() - .HasColumnName("NormalizedUserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("PasswordHash") - .HasColumnName("PasswordHash") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("PhoneNumber") - .HasColumnName("PhoneNumber") - .HasColumnType("nvarchar(16)") - .HasMaxLength(16); - - b.Property("PhoneNumberConfirmed") - .ValueGeneratedOnAdd() - .HasColumnName("PhoneNumberConfirmed") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("SecurityStamp") - .IsRequired() - .HasColumnName("SecurityStamp") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("Surname") - .HasColumnName("Surname") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("TwoFactorEnabled") - .ValueGeneratedOnAdd() - .HasColumnName("TwoFactorEnabled") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("UserName") - .IsRequired() - .HasColumnName("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("Email"); - - b.HasIndex("NormalizedEmail"); - - b.HasIndex("NormalizedUserName"); - - b.HasIndex("UserName"); - - b.ToTable("AbpUsers"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ClaimType") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AbpUserClaims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "LoginProvider"); - - b.HasIndex("LoginProvider", "ProviderKey"); - - b.ToTable("AbpUserLogins"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => - { - b.Property("OrganizationUnitId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("OrganizationUnitId", "UserId"); - - b.HasIndex("UserId", "OrganizationUnitId"); - - b.ToTable("AbpUserOrganizationUnits"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId", "UserId"); - - b.ToTable("AbpUserRoles"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Name") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AbpUserTokens"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnName("Code") - .HasColumnType("nvarchar(95)") - .HasMaxLength(95); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("DisplayName") - .IsRequired() - .HasColumnName("DisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("Code"); - - b.HasIndex("ParentId"); - - b.ToTable("AbpOrganizationUnits"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => - { - b.Property("OrganizationUnitId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("OrganizationUnitId", "RoleId"); - - b.HasIndex("RoleId", "OrganizationUnitId"); - - b.ToTable("AbpOrganizationUnitRoles"); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpPermissionGrants"); - }); - - modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpSettings"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(40)") - .HasMaxLength(40); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("AbpTenants"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.HasKey("TenantId", "Name"); - - b.ToTable("AbpTenantConnectionStrings"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("Actions") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("EntityChanges") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) - .WithMany("PropertyChanges") - .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany("Claims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Claims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany() - .HasForeignKey("OrganizationUnitId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("OrganizationUnits") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Roles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany() - .HasForeignKey("ParentId"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany("Roles") - .HasForeignKey("OrganizationUnitId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.HasOne("Volo.Abp.TenantManagement.Tenant", null) - .WithMany("ConnectionStrings") - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200710065052_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200730102724_Initial.Designer.cs similarity index 99% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200710065052_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200730102724_Initial.Designer.cs index 4afc02af46..063f61a32d 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200710065052_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200730102724_Initial.Designer.cs @@ -11,7 +11,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20200710065052_Initial")] + [Migration("20200730102724_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200710065052_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200730102724_Initial.cs similarity index 100% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200710065052_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200730102724_Initial.cs From 19c704bccaed21c70a86ce7527ddc6fafb36da92 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Thu, 30 Jul 2020 20:12:27 +0800 Subject: [PATCH 26/32] Rename FindByCliendIdAsync to FindByClientIdAsync. --- .../IdentityServer/IdentityServerDataSeedContributor.cs | 2 +- .../IdentityServer/IdentityServerDataSeedContributor.cs | 2 +- .../IdentityServer/IdentityServerDataSeedContributor.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs index c245c663f8..da6f57f337 100644 --- a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs @@ -142,7 +142,7 @@ namespace Volo.CmsKit.IdentityServer string postLogoutRedirectUri = null, IEnumerable permissions = null) { - var client = await _clientRepository.FindByCliendIdAsync(name); + var client = await _clientRepository.FindByClientIdAsync(name); if (client == null) { client = await _clientRepository.InsertAsync( diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs index 3aa7af4691..6071635fe5 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs @@ -165,7 +165,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer string frontChannelLogoutUri = null, IEnumerable permissions = null) { - var client = await _clientRepository.FindByCliendIdAsync(name); + var client = await _clientRepository.FindByClientIdAsync(name); if (client == null) { client = await _clientRepository.InsertAsync( diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs index c3213311a1..d150a1454c 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs @@ -165,7 +165,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer string frontChannelLogoutUri = null, IEnumerable permissions = null) { - var client = await _clientRepository.FindByCliendIdAsync(name); + var client = await _clientRepository.FindByClientIdAsync(name); if (client == null) { client = await _clientRepository.InsertAsync( From 47858b21bc59c94f19e58b60d7919d39679b2fd0 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Thu, 13 Aug 2020 14:31:35 +0800 Subject: [PATCH 27/32] Use AddDeveloperSigningCredential. --- .../Abp/IdentityServer/AbpIdentityServerBuilderExtensions.cs | 4 +++- .../Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerBuilderExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerBuilderExtensions.cs index 81f4b8b629..9763ad35f0 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerBuilderExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerBuilderExtensions.cs @@ -55,7 +55,9 @@ namespace Volo.Abp.IdentityServer return builder; } - public static IIdentityServerBuilder AddAbpDeveloperSigningCredential( + //TODO: Use the latest Identity server code to optimize performance. + // https://github.com/IdentityServer/IdentityServer4/blob/main/src/IdentityServer4/src/Configuration/DependencyInjection/BuilderExtensions/Crypto.cs + private static IIdentityServerBuilder AddAbpDeveloperSigningCredential( this IIdentityServerBuilder builder, bool persistKey = true, string filename = null, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index d07132e094..65d1dd2b42 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -68,7 +68,7 @@ namespace Volo.Abp.IdentityServer if (builderOptions.AddDeveloperSigningCredential) { - identityServerBuilder = identityServerBuilder.AddAbpDeveloperSigningCredential(); + identityServerBuilder = identityServerBuilder.AddDeveloperSigningCredential(); } identityServerBuilder.AddAbpIdentityServer(builderOptions); From c17aa8a1e655d0838610ab505f6b3f81fc8e9028 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Wed, 9 Sep 2020 11:08:28 +0800 Subject: [PATCH 28/32] Add MongoTestCollection to OrganizationUnitRepository_Tests class. --- .../Abp/Identity/MongoDB/OrganizationUnitRepository_Tests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/OrganizationUnitRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/OrganizationUnitRepository_Tests.cs index d60611b2b6..e60b6f21d4 100644 --- a/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/OrganizationUnitRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/OrganizationUnitRepository_Tests.cs @@ -4,6 +4,7 @@ using System.Text; namespace Volo.Abp.Identity.MongoDB { + [Collection(MongoTestCollection.Name)] public class OrganizationUnitRepository_Tests : OrganizationUnitRepository_Tests { } From a5010abd140333b377fc751e1d53b9625ee8bd3f Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Wed, 9 Sep 2020 11:16:17 +0800 Subject: [PATCH 29/32] using Xunit. --- .../Abp/Identity/MongoDB/OrganizationUnitRepository_Tests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/OrganizationUnitRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/OrganizationUnitRepository_Tests.cs index e60b6f21d4..dc134f9974 100644 --- a/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/OrganizationUnitRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/OrganizationUnitRepository_Tests.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using Xunit; namespace Volo.Abp.Identity.MongoDB { From 3dad81499793fd53faa43d457e3120acd8b98916 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 15 Sep 2020 11:54:15 +0800 Subject: [PATCH 30/32] Upgrade IdentityServer4 to 4.1.0 https://github.com/IdentityServer/IdentityServer4/releases/tag/4.1.0 --- .../Volo.Abp.IdentityServer.Domain.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj index 33c5c87bff..758a0c0a04 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj @@ -25,8 +25,8 @@ - - + + From 8f9d0bfdfb25275914aaad7291cda4d264105544 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Mon, 19 Oct 2020 10:12:17 +0800 Subject: [PATCH 31/32] Update template projects migrations. --- ....cs => 20201019020935_Initial.Designer.cs} | 1139 ++++++++------ .../Migrations/20201019020935_Initial.cs | 1380 +++++++++++++++++ ...ectNameMigrationsDbContextModelSnapshot.cs | 1110 +++++++------ ....cs => 20201019021119_Initial.Designer.cs} | 206 +-- ...1_Initial.cs => 20201019021119_Initial.cs} | 114 +- ...ApiHostMigrationsDbContextModelSnapshot.cs | 204 +-- .../Migrations/20201013055209_Initial.cs | 1232 --------------- ....cs => 20201019021120_Initial.Designer.cs} | 1276 +++++++++------ .../Migrations/20201019021120_Initial.cs} | 754 +++++---- ...verHostMigrationsDbContextModelSnapshot.cs | 1090 +++++++------ .../20201019021101_Initial.Designer.cs | 1222 +++++++++++++++ .../Migrations/20201019021101_Initial.cs | 726 +++++++++ .../UnifiedDbContextModelSnapshot.cs | 628 ++++---- 13 files changed, 6890 insertions(+), 4191 deletions(-) rename templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/{20200909022225_Initial.Designer.cs => 20201019020935_Initial.Designer.cs} (66%) create mode 100644 templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20201019020935_Initial.cs rename templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/{20200928072851_Initial.Designer.cs => 20201019021119_Initial.Designer.cs} (63%) rename templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/{20200928072851_Initial.cs => 20201019021119_Initial.cs} (50%) delete mode 100644 templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201013055209_Initial.cs rename templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/{20201013055209_Initial.Designer.cs => 20201019021120_Initial.Designer.cs} (61%) rename templates/{app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200909022225_Initial.cs => module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201019021120_Initial.cs} (53%) create mode 100644 templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201019021101_Initial.Designer.cs create mode 100644 templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201019021101_Initial.cs diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200909022225_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20201019020935_Initial.Designer.cs similarity index 66% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200909022225_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20201019020935_Initial.Designer.cs index cebb89fe4c..7e948c753c 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200909022225_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20201019020935_Initial.Designer.cs @@ -11,17 +11,17 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameMigrationsDbContext))] - [Migration("20200909022225_Initial")] + [Migration("20201019020935_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder + .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "3.1.6") .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -30,99 +30,99 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") - .HasColumnName("ApplicationName") + .HasMaxLength(96) .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasColumnName("ApplicationName"); b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("BrowserInfo"); b.Property("ClientId") - .HasColumnName("ClientId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientId"); b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientIpAddress"); b.Property("ClientName") - .HasColumnName("ClientName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("ClientName"); b.Property("Comments") - .HasColumnName("Comments") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Comments"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnName("CorrelationId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasColumnName("Exceptions") + .HasMaxLength(4000) .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasColumnName("Exceptions"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("HttpMethod") - .HasColumnName("HttpMethod") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("HttpMethod"); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") .HasColumnType("nvarchar(max)"); b.Property("Url") - .HasColumnName("Url") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Url"); b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); b.Property("UserName") - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -140,39 +140,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("MethodName") - .HasColumnName("MethodName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("MethodName"); b.Property("Parameters") - .HasColumnName("Parameters") + .HasMaxLength(2000) .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnName("Parameters"); b.Property("ServiceName") - .HasColumnName("ServiceName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("ServiceName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -190,39 +190,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); b.Property("EntityId") .IsRequired() - .HasColumnName("EntityId") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityId"); b.Property("EntityTenantId") .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() - .HasColumnName("EntityTypeFullName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityTypeFullName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -243,30 +243,30 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("NewValue") - .HasColumnName("NewValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("NewValue"); b.Property("OriginalValue") - .HasColumnName("OriginalValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("OriginalValue"); b.Property("PropertyName") .IsRequired() - .HasColumnName("PropertyName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("PropertyName"); b.Property("PropertyTypeFullName") .IsRequired() - .HasColumnName("PropertyTypeFullName") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("PropertyTypeFullName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -283,17 +283,17 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsAbandoned") .ValueGeneratedOnAdd() @@ -302,13 +302,13 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("JobArgs") .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(1048576); + .HasMaxLength(1048576) + .HasColumnType("nvarchar(max)"); b.Property("JobName") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("LastTryTime") .HasColumnType("datetime2"); @@ -341,21 +341,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.HasKey("Id"); @@ -372,33 +372,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsStatic") .HasColumnType("bit"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("Regex") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("RegexDescription") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Required") .HasColumnType("bit"); @@ -411,6 +411,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpClaimTypes"); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers"); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") @@ -419,39 +446,39 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDefault") - .HasColumnName("IsDefault") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsDefault"); b.Property("IsPublic") - .HasColumnName("IsPublic") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsPublic"); b.Property("IsStatic") - .HasColumnName("IsStatic") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsStatic"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("NormalizedName") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -467,19 +494,19 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClaimType") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.Property("RoleId") .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -495,60 +522,60 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Action") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("CreationTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("Identity") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("UserId") .HasColumnType("uniqueidentifier"); b.Property("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.HasKey("Id"); @@ -571,136 +598,136 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("AccessFailedCount") .ValueGeneratedOnAdd() - .HasColumnName("AccessFailedCount") .HasColumnType("int") - .HasDefaultValue(0); + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Email") .IsRequired() - .HasColumnName("Email") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Email"); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() - .HasColumnName("EmailConfirmed") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("IsExternal") .ValueGeneratedOnAdd() - .HasColumnName("IsExternal") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsExternal"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() - .HasColumnName("LockoutEnabled") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); b.Property("LockoutEnd") .HasColumnType("datetimeoffset"); b.Property("Name") - .HasColumnName("Name") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("Name"); b.Property("NormalizedEmail") .IsRequired() - .HasColumnName("NormalizedEmail") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("NormalizedEmail"); b.Property("NormalizedUserName") .IsRequired() - .HasColumnName("NormalizedUserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("NormalizedUserName"); b.Property("PasswordHash") - .HasColumnName("PasswordHash") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("PasswordHash"); b.Property("PhoneNumber") - .HasColumnName("PhoneNumber") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("PhoneNumber"); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() - .HasColumnName("PhoneNumberConfirmed") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); b.Property("SecurityStamp") .IsRequired() - .HasColumnName("SecurityStamp") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("SecurityStamp"); b.Property("Surname") - .HasColumnName("Surname") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("Surname"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() - .HasColumnName("TwoFactorEnabled") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); b.Property("UserName") .IsRequired() - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -722,16 +749,16 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClaimType") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("UserId") .HasColumnType("uniqueidentifier"); @@ -749,21 +776,21 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("UserId", "LoginProvider"); @@ -781,16 +808,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("OrganizationUnitId", "UserId"); @@ -808,8 +835,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("UserId", "RoleId"); @@ -824,16 +851,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Name") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("Value") .HasColumnType("nvarchar(max)"); @@ -851,62 +878,62 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Code") .IsRequired() - .HasColumnName("Code") + .HasMaxLength(95) .HasColumnType("nvarchar(95)") - .HasMaxLength(95); + .HasColumnName("Code"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("DisplayName") .IsRequired() - .HasColumnName("DisplayName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("DisplayName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("ParentId") .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -926,16 +953,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("OrganizationUnitId", "RoleId"); @@ -951,64 +978,64 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AllowedAccessTokenSigningAlgorithms") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Enabled") .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ShowInDiscoveryDocument") .HasColumnType("bit"); @@ -1027,8 +1054,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ApiResourceId", "Type"); @@ -1041,12 +1068,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ApiResourceId", "Key", "Value"); @@ -1059,8 +1086,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ApiResourceId", "Scope"); @@ -1073,16 +1100,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1100,33 +1127,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Emphasize") .HasColumnType("bit"); @@ -1135,27 +1162,27 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Required") .HasColumnType("bit"); @@ -1177,8 +1204,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ApiScopeId", "Type"); @@ -1191,12 +1218,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ApiScopeId", "Key", "Value"); @@ -1231,8 +1258,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("AllowedIdentityTokenSigningAlgorithms") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("bit"); @@ -1247,54 +1274,54 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("ClientClaimsPrefix") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ConsentLifetime") .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DeviceCodeLifetime") .HasColumnType("int"); @@ -1306,15 +1333,15 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("FrontChannelLogoutSessionRequired") .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("IdentityTokenLifetime") .HasColumnType("int"); @@ -1324,30 +1351,30 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("LogoUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("PairWiseSubjectSalt") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ProtocolType") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("RefreshTokenExpiration") .HasColumnType("int"); @@ -1374,8 +1401,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("UserCodeType") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("UserSsoLifetime") .HasColumnType("int"); @@ -1393,12 +1420,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("ClientId", "Type", "Value"); @@ -1411,8 +1438,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Origin") - .HasColumnType("nvarchar(150)") - .HasMaxLength(150); + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); b.HasKey("ClientId", "Origin"); @@ -1425,8 +1452,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("ClientId", "GrantType"); @@ -1439,8 +1466,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ClientId", "Provider"); @@ -1453,8 +1480,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -1467,12 +1494,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "Key", "Value"); @@ -1485,8 +1512,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "RedirectUri"); @@ -1499,8 +1526,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ClientId", "Scope"); @@ -1513,16 +1540,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1540,57 +1567,57 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("Data") .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); b.Property("Description") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("DeviceCode") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Expiration") .IsRequired() .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("SessionId") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("UserCode") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -1607,19 +1634,19 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ConsumedTime") .HasColumnType("datetime2"); @@ -1629,35 +1656,35 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Data") .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); b.Property("Description") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Expiration") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("Id") .HasColumnType("uniqueidentifier"); b.Property("SessionId") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Type") .IsRequired() - .HasColumnType("nvarchar(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); b.HasKey("Key"); @@ -1678,33 +1705,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Emphasize") .HasColumnType("bit"); @@ -1713,27 +1740,27 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Required") .HasColumnType("bit"); @@ -1755,8 +1782,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("IdentityResourceId", "Type"); @@ -1769,12 +1796,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("IdentityResourceId", "Key", "Value"); @@ -1789,22 +1816,22 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -1821,21 +1848,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); b.HasKey("Id"); @@ -1852,48 +1879,48 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.HasKey("Id"); @@ -1908,13 +1935,13 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.HasKey("TenantId", "Name"); @@ -2197,6 +2224,92 @@ namespace MyCompanyName.MyProjectName.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); #pragma warning restore 612, 618 } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20201019020935_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20201019020935_Initial.cs new file mode 100644 index 0000000000..dfa2b7fbd5 --- /dev/null +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20201019020935_Initial.cs @@ -0,0 +1,1380 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace MyCompanyName.MyProjectName.Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AbpAuditLogs", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + TenantName = table.Column(type: "nvarchar(max)", nullable: true), + ImpersonatorUserId = table.Column(type: "uniqueidentifier", nullable: true), + ImpersonatorTenantId = table.Column(type: "uniqueidentifier", nullable: true), + ExecutionTime = table.Column(type: "datetime2", nullable: false), + ExecutionDuration = table.Column(type: "int", nullable: false), + ClientIpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ClientName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + ClientId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + CorrelationId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + HttpMethod = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + Exceptions = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true), + Comments = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + HttpStatusCode = table.Column(type: "int", nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpBackgroundJobs", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + JobName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + JobArgs = table.Column(type: "nvarchar(max)", maxLength: 1048576, nullable: false), + TryCount = table.Column(type: "smallint", nullable: false, defaultValue: (short)0), + CreationTime = table.Column(type: "datetime2", nullable: false), + NextTryTime = table.Column(type: "datetime2", nullable: false), + LastTryTime = table.Column(type: "datetime2", nullable: true), + IsAbandoned = table.Column(type: "bit", nullable: false, defaultValue: false), + Priority = table.Column(type: "tinyint", nullable: false, defaultValue: (byte)15), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpClaimTypes", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Required = table.Column(type: "bit", nullable: false), + IsStatic = table.Column(type: "bit", nullable: false), + Regex = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + RegexDescription = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Description = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ValueType = table.Column(type: "int", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpFeatureValues", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Value = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpFeatureValues", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpLinkUsers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + SourceUserId = table.Column(type: "uniqueidentifier", nullable: false), + SourceTenantId = table.Column(type: "uniqueidentifier", nullable: true), + TargetUserId = table.Column(type: "uniqueidentifier", nullable: false), + TargetTenantId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpLinkUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpOrganizationUnits", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ParentId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(95)", maxLength: 95, nullable: false), + DisplayName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id); + table.ForeignKey( + name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", + column: x => x.ParentId, + principalTable: "AbpOrganizationUnits", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "AbpPermissionGrants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpRoles", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + IsDefault = table.Column(type: "bit", nullable: false), + IsStatic = table.Column(type: "bit", nullable: false), + IsPublic = table.Column(type: "bit", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpSecurityLogs", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + Identity = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + Action = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + TenantName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ClientId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + CorrelationId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ClientIpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpSettings", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Value = table.Column(type: "nvarchar(2048)", maxLength: 2048, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSettings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpTenants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpUsers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Surname = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + EmailConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false), + PasswordHash = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + SecurityStamp = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + IsExternal = table.Column(type: "bit", nullable: false, defaultValue: false), + PhoneNumber = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + PhoneNumberConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false), + TwoFactorEnabled = table.Column(type: "bit", nullable: false, defaultValue: false), + LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), + LockoutEnabled = table.Column(type: "bit", nullable: false, defaultValue: false), + AccessFailedCount = table.Column(type: "int", nullable: false, defaultValue: 0), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiResources", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Enabled = table.Column(type: "bit", nullable: false), + AllowedAccessTokenSigningAlgorithms = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiScopes", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Enabled = table.Column(type: "bit", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Required = table.Column(type: "bit", nullable: false), + Emphasize = table.Column(type: "bit", nullable: false), + ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiScopes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClients", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ClientName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + ClientUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + LogoUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + Enabled = table.Column(type: "bit", nullable: false), + ProtocolType = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + RequireClientSecret = table.Column(type: "bit", nullable: false), + RequireConsent = table.Column(type: "bit", nullable: false), + AllowRememberConsent = table.Column(type: "bit", nullable: false), + AlwaysIncludeUserClaimsInIdToken = table.Column(type: "bit", nullable: false), + RequirePkce = table.Column(type: "bit", nullable: false), + AllowPlainTextPkce = table.Column(type: "bit", nullable: false), + RequireRequestObject = table.Column(type: "bit", nullable: false), + AllowAccessTokensViaBrowser = table.Column(type: "bit", nullable: false), + FrontChannelLogoutUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + FrontChannelLogoutSessionRequired = table.Column(type: "bit", nullable: false), + BackChannelLogoutUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + BackChannelLogoutSessionRequired = table.Column(type: "bit", nullable: false), + AllowOfflineAccess = table.Column(type: "bit", nullable: false), + IdentityTokenLifetime = table.Column(type: "int", nullable: false), + AllowedIdentityTokenSigningAlgorithms = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + AccessTokenLifetime = table.Column(type: "int", nullable: false), + AuthorizationCodeLifetime = table.Column(type: "int", nullable: false), + ConsentLifetime = table.Column(type: "int", nullable: true), + AbsoluteRefreshTokenLifetime = table.Column(type: "int", nullable: false), + SlidingRefreshTokenLifetime = table.Column(type: "int", nullable: false), + RefreshTokenUsage = table.Column(type: "int", nullable: false), + UpdateAccessTokenClaimsOnRefresh = table.Column(type: "bit", nullable: false), + RefreshTokenExpiration = table.Column(type: "int", nullable: false), + AccessTokenType = table.Column(type: "int", nullable: false), + EnableLocalLogin = table.Column(type: "bit", nullable: false), + IncludeJwtId = table.Column(type: "bit", nullable: false), + AlwaysSendClientClaims = table.Column(type: "bit", nullable: false), + ClientClaimsPrefix = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + PairWiseSubjectSalt = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + UserSsoLifetime = table.Column(type: "int", nullable: true), + UserCodeType = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + DeviceCodeLifetime = table.Column(type: "int", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClients", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerDeviceFlowCodes", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + DeviceCode = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + UserCode = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + SubjectId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + SessionId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Expiration = table.Column(type: "datetime2", nullable: false), + Data = table.Column(type: "nvarchar(max)", maxLength: 50000, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerIdentityResources", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Enabled = table.Column(type: "bit", nullable: false), + Required = table.Column(type: "bit", nullable: false), + Emphasize = table.Column(type: "bit", nullable: false), + ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerPersistedGrants", + columns: table => new + { + Key = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Type = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + SubjectId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + SessionId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + Expiration = table.Column(type: "datetime2", nullable: true), + ConsumedTime = table.Column(type: "datetime2", nullable: true), + Data = table.Column(type: "nvarchar(max)", maxLength: 50000, nullable: false), + Id = table.Column(type: "uniqueidentifier", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); + }); + + migrationBuilder.CreateTable( + name: "AbpAuditLogActions", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + AuditLogId = table.Column(type: "uniqueidentifier", nullable: false), + ServiceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + MethodName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Parameters = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + ExecutionTime = table.Column(type: "datetime2", nullable: false), + ExecutionDuration = table.Column(type: "int", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); + table.ForeignKey( + name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", + column: x => x.AuditLogId, + principalTable: "AbpAuditLogs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpEntityChanges", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + AuditLogId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ChangeTime = table.Column(type: "datetime2", nullable: false), + ChangeType = table.Column(type: "tinyint", nullable: false), + EntityTenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + EntityTypeFullName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); + table.ForeignKey( + name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", + column: x => x.AuditLogId, + principalTable: "AbpAuditLogs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpOrganizationUnitRoles", + columns: table => new + { + RoleId = table.Column(type: "uniqueidentifier", nullable: false), + OrganizationUnitId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpOrganizationUnitRoles", x => new { x.OrganizationUnitId, x.RoleId }); + table.ForeignKey( + name: "FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUnitId", + column: x => x.OrganizationUnitId, + principalTable: "AbpOrganizationUnits", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AbpOrganizationUnitRoles_AbpRoles_RoleId", + column: x => x.RoleId, + principalTable: "AbpRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpRoleClaims", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + RoleId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ClaimType = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ClaimValue = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true) + }, + 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: "AbpTenantConnectionStrings", + columns: table => new + { + TenantId = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Value = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); + table.ForeignKey( + name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", + column: x => x.TenantId, + principalTable: "AbpTenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserClaims", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ClaimType = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ClaimValue = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true) + }, + 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 + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + LoginProvider = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ProviderKey = table.Column(type: "nvarchar(196)", maxLength: 196, nullable: false), + ProviderDisplayName = table.Column(type: "nvarchar(128)", 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: "AbpUserOrganizationUnits", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + OrganizationUnitId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserOrganizationUnits", x => new { x.OrganizationUnitId, x.UserId }); + table.ForeignKey( + name: "FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUnitId", + column: x => x.OrganizationUnitId, + principalTable: "AbpOrganizationUnits", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AbpUserOrganizationUnits_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserRoles", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + RoleId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true) + }, + 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 + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + LoginProvider = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Value = table.Column(type: "nvarchar(max)", 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: "IdentityServerApiResourceClaims", + columns: table => new + { + Type = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ApiResourceId = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiResourceClaims", x => new { x.ApiResourceId, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerApiResourceClaims_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiResourceProperties", + columns: table => new + { + ApiResourceId = table.Column(type: "uniqueidentifier", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiResourceProperties", x => new { x.ApiResourceId, x.Key, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerApiResourceProperties_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiResourceScopes", + columns: table => new + { + ApiResourceId = table.Column(type: "uniqueidentifier", nullable: false), + Scope = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiResourceScopes", x => new { x.ApiResourceId, x.Scope }); + table.ForeignKey( + name: "FK_IdentityServerApiResourceScopes_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiResourceSecrets", + columns: table => new + { + Type = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: false), + ApiResourceId = table.Column(type: "uniqueidentifier", nullable: false), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Expiration = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiResourceSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerApiResourceSecrets_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiScopeClaims", + columns: table => new + { + Type = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ApiScopeId = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiScopeId, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiScopeId", + column: x => x.ApiScopeId, + principalTable: "IdentityServerApiScopes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiScopeProperties", + columns: table => new + { + ApiScopeId = table.Column(type: "uniqueidentifier", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiScopeProperties", x => new { x.ApiScopeId, x.Key, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerApiScopeProperties_IdentityServerApiScopes_ApiScopeId", + column: x => x.ApiScopeId, + principalTable: "IdentityServerApiScopes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientClaims", + columns: table => new + { + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Type = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientCorsOrigins", + columns: table => new + { + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Origin = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin }); + table.ForeignKey( + name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientGrantTypes", + columns: table => new + { + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + GrantType = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType }); + table.ForeignKey( + name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientIdPRestrictions", + columns: table => new + { + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Provider = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider }); + table.ForeignKey( + name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientPostLogoutRedirectUris", + columns: table => new + { + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + PostLogoutRedirectUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri }); + table.ForeignKey( + name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientProperties", + columns: table => new + { + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientRedirectUris", + columns: table => new + { + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + RedirectUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri }); + table.ForeignKey( + name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientScopes", + columns: table => new + { + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Scope = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope }); + table.ForeignKey( + name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientSecrets", + columns: table => new + { + Type = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: false), + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Description = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + Expiration = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerIdentityResourceClaims", + columns: table => new + { + Type = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + IdentityResourceId = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerIdentityResourceClaims", x => new { x.IdentityResourceId, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerIdentityResourceClaims_IdentityServerIdentityResources_IdentityResourceId", + column: x => x.IdentityResourceId, + principalTable: "IdentityServerIdentityResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerIdentityResourceProperties", + columns: table => new + { + IdentityResourceId = table.Column(type: "uniqueidentifier", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerIdentityResourceProperties", x => new { x.IdentityResourceId, x.Key, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerIdentityResourceProperties_IdentityServerIdentityResources_IdentityResourceId", + column: x => x.IdentityResourceId, + principalTable: "IdentityServerIdentityResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpEntityPropertyChanges", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityChangeId = table.Column(type: "uniqueidentifier", nullable: false), + NewValue = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + OriginalValue = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + PropertyName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + PropertyTypeFullName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); + table.ForeignKey( + name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", + column: x => x.EntityChangeId, + principalTable: "AbpEntityChanges", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogActions_AuditLogId", + table: "AbpAuditLogActions", + column: "AuditLogId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", + table: "AbpAuditLogActions", + columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogs_TenantId_ExecutionTime", + table: "AbpAuditLogs", + columns: new[] { "TenantId", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", + table: "AbpAuditLogs", + columns: new[] { "TenantId", "UserId", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", + table: "AbpBackgroundJobs", + columns: new[] { "IsAbandoned", "NextTryTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityChanges_AuditLogId", + table: "AbpEntityChanges", + column: "AuditLogId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", + table: "AbpEntityChanges", + columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityPropertyChanges_EntityChangeId", + table: "AbpEntityPropertyChanges", + column: "EntityChangeId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", + table: "AbpFeatureValues", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId", + table: "AbpLinkUsers", + columns: new[] { "SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId" }, + unique: true, + filter: "[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", + table: "AbpOrganizationUnitRoles", + columns: new[] { "RoleId", "OrganizationUnitId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpOrganizationUnits_Code", + table: "AbpOrganizationUnits", + column: "Code"); + + migrationBuilder.CreateIndex( + name: "IX_AbpOrganizationUnits_ParentId", + table: "AbpOrganizationUnits", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + table: "AbpPermissionGrants", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpRoleClaims_RoleId", + table: "AbpRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpRoles_NormalizedName", + table: "AbpRoles", + column: "NormalizedName"); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_Action", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "Action" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_ApplicationName", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "ApplicationName" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_Identity", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "Identity" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_UserId", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "UserId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSettings_Name_ProviderName_ProviderKey", + table: "AbpSettings", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpTenants_Name", + table: "AbpTenants", + column: "Name"); + + 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_AbpUserOrganizationUnits_UserId_OrganizationUnitId", + table: "AbpUserOrganizationUnits", + columns: new[] { "UserId", "OrganizationUnitId" }); + + 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_IdentityServerApiResources_Name", + table: "IdentityServerApiResources", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerApiScopes_Name", + table: "IdentityServerApiScopes", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerClients_ClientId", + table: "IdentityServerClients", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", + table: "IdentityServerDeviceFlowCodes", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_Expiration", + table: "IdentityServerDeviceFlowCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_UserCode", + table: "IdentityServerDeviceFlowCodes", + column: "UserCode"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerIdentityResources_Name", + table: "IdentityServerIdentityResources", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_Expiration", + table: "IdentityServerPersistedGrants", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", + table: "IdentityServerPersistedGrants", + columns: new[] { "SubjectId", "ClientId", "Type" }); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_SubjectId_SessionId_Type", + table: "IdentityServerPersistedGrants", + columns: new[] { "SubjectId", "SessionId", "Type" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpAuditLogActions"); + + migrationBuilder.DropTable( + name: "AbpBackgroundJobs"); + + migrationBuilder.DropTable( + name: "AbpClaimTypes"); + + migrationBuilder.DropTable( + name: "AbpEntityPropertyChanges"); + + migrationBuilder.DropTable( + name: "AbpFeatureValues"); + + migrationBuilder.DropTable( + name: "AbpLinkUsers"); + + migrationBuilder.DropTable( + name: "AbpOrganizationUnitRoles"); + + migrationBuilder.DropTable( + name: "AbpPermissionGrants"); + + migrationBuilder.DropTable( + name: "AbpRoleClaims"); + + migrationBuilder.DropTable( + name: "AbpSecurityLogs"); + + migrationBuilder.DropTable( + name: "AbpSettings"); + + migrationBuilder.DropTable( + name: "AbpTenantConnectionStrings"); + + migrationBuilder.DropTable( + name: "AbpUserClaims"); + + migrationBuilder.DropTable( + name: "AbpUserLogins"); + + migrationBuilder.DropTable( + name: "AbpUserOrganizationUnits"); + + migrationBuilder.DropTable( + name: "AbpUserRoles"); + + migrationBuilder.DropTable( + name: "AbpUserTokens"); + + migrationBuilder.DropTable( + name: "IdentityServerApiResourceClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerApiResourceProperties"); + + migrationBuilder.DropTable( + name: "IdentityServerApiResourceScopes"); + + migrationBuilder.DropTable( + name: "IdentityServerApiResourceSecrets"); + + migrationBuilder.DropTable( + name: "IdentityServerApiScopeClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerApiScopeProperties"); + + migrationBuilder.DropTable( + name: "IdentityServerClientClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerClientCorsOrigins"); + + migrationBuilder.DropTable( + name: "IdentityServerClientGrantTypes"); + + migrationBuilder.DropTable( + name: "IdentityServerClientIdPRestrictions"); + + migrationBuilder.DropTable( + name: "IdentityServerClientPostLogoutRedirectUris"); + + migrationBuilder.DropTable( + name: "IdentityServerClientProperties"); + + migrationBuilder.DropTable( + name: "IdentityServerClientRedirectUris"); + + migrationBuilder.DropTable( + name: "IdentityServerClientScopes"); + + migrationBuilder.DropTable( + name: "IdentityServerClientSecrets"); + + migrationBuilder.DropTable( + name: "IdentityServerDeviceFlowCodes"); + + migrationBuilder.DropTable( + name: "IdentityServerIdentityResourceClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerIdentityResourceProperties"); + + migrationBuilder.DropTable( + name: "IdentityServerPersistedGrants"); + + migrationBuilder.DropTable( + name: "AbpEntityChanges"); + + migrationBuilder.DropTable( + name: "AbpTenants"); + + migrationBuilder.DropTable( + name: "AbpOrganizationUnits"); + + migrationBuilder.DropTable( + name: "AbpRoles"); + + migrationBuilder.DropTable( + name: "AbpUsers"); + + migrationBuilder.DropTable( + name: "IdentityServerApiResources"); + + migrationBuilder.DropTable( + name: "IdentityServerApiScopes"); + + migrationBuilder.DropTable( + name: "IdentityServerClients"); + + migrationBuilder.DropTable( + name: "IdentityServerIdentityResources"); + + migrationBuilder.DropTable( + name: "AbpAuditLogs"); + } + } +} diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs index 44036df56d..657232cff2 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs @@ -16,10 +16,10 @@ namespace MyCompanyName.MyProjectName.Migrations { #pragma warning disable 612, 618 modelBuilder + .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "3.1.8") .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -28,99 +28,99 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") - .HasColumnName("ApplicationName") + .HasMaxLength(96) .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasColumnName("ApplicationName"); b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("BrowserInfo"); b.Property("ClientId") - .HasColumnName("ClientId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientId"); b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientIpAddress"); b.Property("ClientName") - .HasColumnName("ClientName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("ClientName"); b.Property("Comments") - .HasColumnName("Comments") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Comments"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnName("CorrelationId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasColumnName("Exceptions") + .HasMaxLength(4000) .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasColumnName("Exceptions"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("HttpMethod") - .HasColumnName("HttpMethod") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("HttpMethod"); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") .HasColumnType("nvarchar(max)"); b.Property("Url") - .HasColumnName("Url") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Url"); b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); b.Property("UserName") - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -138,39 +138,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("MethodName") - .HasColumnName("MethodName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("MethodName"); b.Property("Parameters") - .HasColumnName("Parameters") + .HasMaxLength(2000) .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnName("Parameters"); b.Property("ServiceName") - .HasColumnName("ServiceName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("ServiceName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -188,39 +188,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); b.Property("EntityId") .IsRequired() - .HasColumnName("EntityId") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityId"); b.Property("EntityTenantId") .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() - .HasColumnName("EntityTypeFullName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityTypeFullName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -241,30 +241,30 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("NewValue") - .HasColumnName("NewValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("NewValue"); b.Property("OriginalValue") - .HasColumnName("OriginalValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("OriginalValue"); b.Property("PropertyName") .IsRequired() - .HasColumnName("PropertyName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("PropertyName"); b.Property("PropertyTypeFullName") .IsRequired() - .HasColumnName("PropertyTypeFullName") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("PropertyTypeFullName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -281,17 +281,17 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsAbandoned") .ValueGeneratedOnAdd() @@ -300,13 +300,13 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("JobArgs") .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(1048576); + .HasMaxLength(1048576) + .HasColumnType("nvarchar(max)"); b.Property("JobName") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("LastTryTime") .HasColumnType("datetime2"); @@ -339,21 +339,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.HasKey("Id"); @@ -370,33 +370,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsStatic") .HasColumnType("bit"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("Regex") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("RegexDescription") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Required") .HasColumnType("bit"); @@ -444,39 +444,39 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDefault") - .HasColumnName("IsDefault") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsDefault"); b.Property("IsPublic") - .HasColumnName("IsPublic") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsPublic"); b.Property("IsStatic") - .HasColumnName("IsStatic") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsStatic"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("NormalizedName") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -492,19 +492,19 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClaimType") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.Property("RoleId") .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -520,60 +520,60 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Action") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("CreationTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("Identity") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("UserId") .HasColumnType("uniqueidentifier"); b.Property("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.HasKey("Id"); @@ -596,136 +596,136 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("AccessFailedCount") .ValueGeneratedOnAdd() - .HasColumnName("AccessFailedCount") .HasColumnType("int") - .HasDefaultValue(0); + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Email") .IsRequired() - .HasColumnName("Email") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Email"); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() - .HasColumnName("EmailConfirmed") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("IsExternal") .ValueGeneratedOnAdd() - .HasColumnName("IsExternal") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsExternal"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() - .HasColumnName("LockoutEnabled") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); b.Property("LockoutEnd") .HasColumnType("datetimeoffset"); b.Property("Name") - .HasColumnName("Name") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("Name"); b.Property("NormalizedEmail") .IsRequired() - .HasColumnName("NormalizedEmail") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("NormalizedEmail"); b.Property("NormalizedUserName") .IsRequired() - .HasColumnName("NormalizedUserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("NormalizedUserName"); b.Property("PasswordHash") - .HasColumnName("PasswordHash") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("PasswordHash"); b.Property("PhoneNumber") - .HasColumnName("PhoneNumber") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("PhoneNumber"); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() - .HasColumnName("PhoneNumberConfirmed") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); b.Property("SecurityStamp") .IsRequired() - .HasColumnName("SecurityStamp") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("SecurityStamp"); b.Property("Surname") - .HasColumnName("Surname") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("Surname"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() - .HasColumnName("TwoFactorEnabled") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); b.Property("UserName") .IsRequired() - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -747,16 +747,16 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClaimType") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("UserId") .HasColumnType("uniqueidentifier"); @@ -774,21 +774,21 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("UserId", "LoginProvider"); @@ -806,16 +806,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("OrganizationUnitId", "UserId"); @@ -833,8 +833,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("UserId", "RoleId"); @@ -849,16 +849,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Name") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("Value") .HasColumnType("nvarchar(max)"); @@ -876,62 +876,62 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Code") .IsRequired() - .HasColumnName("Code") + .HasMaxLength(95) .HasColumnType("nvarchar(95)") - .HasMaxLength(95); + .HasColumnName("Code"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("DisplayName") .IsRequired() - .HasColumnName("DisplayName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("DisplayName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("ParentId") .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -951,16 +951,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("OrganizationUnitId", "RoleId"); @@ -976,64 +976,64 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AllowedAccessTokenSigningAlgorithms") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Enabled") .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ShowInDiscoveryDocument") .HasColumnType("bit"); @@ -1052,8 +1052,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ApiResourceId", "Type"); @@ -1066,12 +1066,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ApiResourceId", "Key", "Value"); @@ -1084,8 +1084,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ApiResourceId", "Scope"); @@ -1098,16 +1098,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1125,33 +1125,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Emphasize") .HasColumnType("bit"); @@ -1160,27 +1160,27 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Required") .HasColumnType("bit"); @@ -1202,8 +1202,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ApiScopeId", "Type"); @@ -1216,12 +1216,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ApiScopeId", "Key", "Value"); @@ -1256,8 +1256,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("AllowedIdentityTokenSigningAlgorithms") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("bit"); @@ -1272,54 +1272,54 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("ClientClaimsPrefix") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ConsentLifetime") .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DeviceCodeLifetime") .HasColumnType("int"); @@ -1331,15 +1331,15 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("FrontChannelLogoutSessionRequired") .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("IdentityTokenLifetime") .HasColumnType("int"); @@ -1349,30 +1349,30 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("LogoUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("PairWiseSubjectSalt") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ProtocolType") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("RefreshTokenExpiration") .HasColumnType("int"); @@ -1399,8 +1399,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("UserCodeType") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("UserSsoLifetime") .HasColumnType("int"); @@ -1418,12 +1418,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("ClientId", "Type", "Value"); @@ -1436,8 +1436,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Origin") - .HasColumnType("nvarchar(150)") - .HasMaxLength(150); + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); b.HasKey("ClientId", "Origin"); @@ -1450,8 +1450,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("ClientId", "GrantType"); @@ -1464,8 +1464,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ClientId", "Provider"); @@ -1478,8 +1478,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -1492,12 +1492,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "Key", "Value"); @@ -1510,8 +1510,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "RedirectUri"); @@ -1524,8 +1524,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ClientId", "Scope"); @@ -1538,16 +1538,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1565,57 +1565,57 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("Data") .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); b.Property("Description") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("DeviceCode") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Expiration") .IsRequired() .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("SessionId") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("UserCode") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -1632,19 +1632,19 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ConsumedTime") .HasColumnType("datetime2"); @@ -1654,35 +1654,35 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Data") .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); b.Property("Description") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Expiration") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("Id") .HasColumnType("uniqueidentifier"); b.Property("SessionId") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Type") .IsRequired() - .HasColumnType("nvarchar(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); b.HasKey("Key"); @@ -1703,33 +1703,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Emphasize") .HasColumnType("bit"); @@ -1738,27 +1738,27 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Required") .HasColumnType("bit"); @@ -1780,8 +1780,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("IdentityResourceId", "Type"); @@ -1794,12 +1794,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("IdentityResourceId", "Key", "Value"); @@ -1814,22 +1814,22 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -1846,21 +1846,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); b.HasKey("Id"); @@ -1877,48 +1877,48 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.HasKey("Id"); @@ -1933,13 +1933,13 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.HasKey("TenantId", "Name"); @@ -2222,6 +2222,92 @@ namespace MyCompanyName.MyProjectName.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); #pragma warning restore 612, 618 } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20200928072851_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20201019021119_Initial.Designer.cs similarity index 63% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20200928072851_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20201019021119_Initial.Designer.cs index 2ad2035056..119214a82e 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20200928072851_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20201019021119_Initial.Designer.cs @@ -11,17 +11,17 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameHttpApiHostMigrationsDbContext))] - [Migration("20200928072851_Initial")] + [Migration("20201019021119_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder + .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "3.1.6") .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -30,99 +30,99 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") - .HasColumnName("ApplicationName") + .HasMaxLength(96) .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasColumnName("ApplicationName"); b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("BrowserInfo"); b.Property("ClientId") - .HasColumnName("ClientId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientId"); b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientIpAddress"); b.Property("ClientName") - .HasColumnName("ClientName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("ClientName"); b.Property("Comments") - .HasColumnName("Comments") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Comments"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnName("CorrelationId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasColumnName("Exceptions") + .HasMaxLength(4000) .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasColumnName("Exceptions"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("HttpMethod") - .HasColumnName("HttpMethod") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("HttpMethod"); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") .HasColumnType("nvarchar(max)"); b.Property("Url") - .HasColumnName("Url") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Url"); b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); b.Property("UserName") - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -140,39 +140,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("MethodName") - .HasColumnName("MethodName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("MethodName"); b.Property("Parameters") - .HasColumnName("Parameters") + .HasMaxLength(2000) .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnName("Parameters"); b.Property("ServiceName") - .HasColumnName("ServiceName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("ServiceName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -190,39 +190,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); b.Property("EntityId") .IsRequired() - .HasColumnName("EntityId") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityId"); b.Property("EntityTenantId") .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() - .HasColumnName("EntityTypeFullName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityTypeFullName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -243,30 +243,30 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("NewValue") - .HasColumnName("NewValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("NewValue"); b.Property("OriginalValue") - .HasColumnName("OriginalValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("OriginalValue"); b.Property("PropertyName") .IsRequired() - .HasColumnName("PropertyName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("PropertyName"); b.Property("PropertyTypeFullName") .IsRequired() - .HasColumnName("PropertyTypeFullName") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("PropertyTypeFullName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -283,22 +283,22 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -315,21 +315,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); b.HasKey("Id"); @@ -364,6 +364,18 @@ namespace MyCompanyName.MyProjectName.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); #pragma warning restore 612, 618 } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20200928072851_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20201019021119_Initial.cs similarity index 50% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20200928072851_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20201019021119_Initial.cs index 91345ac0a7..71b8ab569f 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20200928072851_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/20201019021119_Initial.cs @@ -11,28 +11,28 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpAuditLogs", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantId = table.Column(nullable: true), - TenantName = table.Column(nullable: true), - ImpersonatorUserId = table.Column(nullable: true), - ImpersonatorTenantId = table.Column(nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - ClientName = table.Column(maxLength: 128, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - HttpMethod = table.Column(maxLength: 16, nullable: true), - Url = table.Column(maxLength: 256, nullable: true), - Exceptions = table.Column(maxLength: 4000, nullable: true), - Comments = table.Column(maxLength: 256, nullable: true), - HttpStatusCode = table.Column(nullable: true) + Id = table.Column(type: "uniqueidentifier", nullable: false), + ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + TenantName = table.Column(type: "nvarchar(max)", nullable: true), + ImpersonatorUserId = table.Column(type: "uniqueidentifier", nullable: true), + ImpersonatorTenantId = table.Column(type: "uniqueidentifier", nullable: true), + ExecutionTime = table.Column(type: "datetime2", nullable: false), + ExecutionDuration = table.Column(type: "int", nullable: false), + ClientIpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ClientName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + ClientId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + CorrelationId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + HttpMethod = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + Exceptions = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true), + Comments = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + HttpStatusCode = table.Column(type: "int", nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) }, constraints: table => { @@ -43,11 +43,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpPermissionGrants", columns: table => new { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: false), - ProviderKey = table.Column(maxLength: 64, nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false) }, constraints: table => { @@ -58,11 +58,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpSettings", columns: table => new { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 2048, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Value = table.Column(type: "nvarchar(2048)", maxLength: 2048, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true) }, constraints: table => { @@ -73,15 +73,15 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpAuditLogActions", columns: table => new { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - AuditLogId = table.Column(nullable: false), - ServiceName = table.Column(maxLength: 256, nullable: true), - MethodName = table.Column(maxLength: 128, nullable: true), - Parameters = table.Column(maxLength: 2000, nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true) + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + AuditLogId = table.Column(type: "uniqueidentifier", nullable: false), + ServiceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + MethodName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Parameters = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + ExecutionTime = table.Column(type: "datetime2", nullable: false), + ExecutionDuration = table.Column(type: "int", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -98,15 +98,15 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpEntityChanges", columns: table => new { - Id = table.Column(nullable: false), - AuditLogId = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ChangeTime = table.Column(nullable: false), - ChangeType = table.Column(nullable: false), - EntityTenantId = table.Column(nullable: true), - EntityId = table.Column(maxLength: 128, nullable: false), - EntityTypeFullName = table.Column(maxLength: 128, nullable: false), - ExtraProperties = table.Column(nullable: true) + Id = table.Column(type: "uniqueidentifier", nullable: false), + AuditLogId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ChangeTime = table.Column(type: "datetime2", nullable: false), + ChangeType = table.Column(type: "tinyint", nullable: false), + EntityTenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + EntityTypeFullName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -123,13 +123,13 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpEntityPropertyChanges", columns: table => new { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - EntityChangeId = table.Column(nullable: false), - NewValue = table.Column(maxLength: 512, nullable: true), - OriginalValue = table.Column(maxLength: 512, nullable: true), - PropertyName = table.Column(maxLength: 128, nullable: false), - PropertyTypeFullName = table.Column(maxLength: 64, nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityChangeId = table.Column(type: "uniqueidentifier", nullable: false), + NewValue = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + OriginalValue = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + PropertyName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + PropertyTypeFullName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false) }, constraints: table => { diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/MyProjectNameHttpApiHostMigrationsDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/MyProjectNameHttpApiHostMigrationsDbContextModelSnapshot.cs index 8a6bbe1a3c..5ede5096a0 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/MyProjectNameHttpApiHostMigrationsDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations/MyProjectNameHttpApiHostMigrationsDbContextModelSnapshot.cs @@ -16,10 +16,10 @@ namespace MyCompanyName.MyProjectName.Migrations { #pragma warning disable 612, 618 modelBuilder + .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "3.1.6") .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -28,99 +28,99 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") - .HasColumnName("ApplicationName") + .HasMaxLength(96) .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasColumnName("ApplicationName"); b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("BrowserInfo"); b.Property("ClientId") - .HasColumnName("ClientId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientId"); b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientIpAddress"); b.Property("ClientName") - .HasColumnName("ClientName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("ClientName"); b.Property("Comments") - .HasColumnName("Comments") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Comments"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnName("CorrelationId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasColumnName("Exceptions") + .HasMaxLength(4000) .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasColumnName("Exceptions"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("HttpMethod") - .HasColumnName("HttpMethod") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("HttpMethod"); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") .HasColumnType("nvarchar(max)"); b.Property("Url") - .HasColumnName("Url") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Url"); b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); b.Property("UserName") - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -138,39 +138,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("MethodName") - .HasColumnName("MethodName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("MethodName"); b.Property("Parameters") - .HasColumnName("Parameters") + .HasMaxLength(2000) .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnName("Parameters"); b.Property("ServiceName") - .HasColumnName("ServiceName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("ServiceName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -188,39 +188,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); b.Property("EntityId") .IsRequired() - .HasColumnName("EntityId") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityId"); b.Property("EntityTenantId") .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() - .HasColumnName("EntityTypeFullName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityTypeFullName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -241,30 +241,30 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("NewValue") - .HasColumnName("NewValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("NewValue"); b.Property("OriginalValue") - .HasColumnName("OriginalValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("OriginalValue"); b.Property("PropertyName") .IsRequired() - .HasColumnName("PropertyName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("PropertyName"); b.Property("PropertyTypeFullName") .IsRequired() - .HasColumnName("PropertyTypeFullName") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("PropertyTypeFullName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -281,22 +281,22 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -313,21 +313,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); b.HasKey("Id"); @@ -362,6 +362,18 @@ namespace MyCompanyName.MyProjectName.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); #pragma warning restore 612, 618 } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201013055209_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201013055209_Initial.cs deleted file mode 100644 index d18a756fc0..0000000000 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201013055209_Initial.cs +++ /dev/null @@ -1,1232 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MyCompanyName.MyProjectName.Migrations -{ - public partial class Initial : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AbpAuditLogs", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantId = table.Column(nullable: true), - TenantName = table.Column(nullable: true), - ImpersonatorUserId = table.Column(nullable: true), - ImpersonatorTenantId = table.Column(nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - ClientName = table.Column(maxLength: 128, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - HttpMethod = table.Column(maxLength: 16, nullable: true), - Url = table.Column(maxLength: 256, nullable: true), - Exceptions = table.Column(maxLength: 4000, nullable: true), - Comments = table.Column(maxLength: 256, nullable: true), - HttpStatusCode = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpClaimTypes", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - Name = table.Column(maxLength: 256, nullable: false), - Required = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - Regex = table.Column(maxLength: 512, nullable: true), - RegexDescription = table.Column(maxLength: 128, nullable: true), - Description = table.Column(maxLength: 256, nullable: true), - ValueType = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpFeatureValues", - columns: table => new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpFeatureValues", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpLinkUsers", - columns: table => new - { - Id = table.Column(nullable: false), - SourceUserId = table.Column(nullable: false), - SourceTenantId = table.Column(nullable: true), - TargetUserId = table.Column(nullable: false), - TargetTenantId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpLinkUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpOrganizationUnits", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - TenantId = table.Column(nullable: true), - ParentId = table.Column(nullable: true), - Code = table.Column(maxLength: 95, nullable: false), - DisplayName = table.Column(maxLength: 128, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id); - table.ForeignKey( - name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", - column: x => x.ParentId, - principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "AbpPermissionGrants", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: false), - ProviderKey = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpRoles", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 256, nullable: false), - NormalizedName = table.Column(maxLength: 256, nullable: false), - IsDefault = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - IsPublic = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpSecurityLogs", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - TenantId = table.Column(nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - Identity = table.Column(maxLength: 96, nullable: true), - Action = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantName = table.Column(maxLength: 64, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - CreationTime = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpSettings", - columns: table => new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 2048, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpSettings", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpTenants", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpTenants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpUsers", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - TenantId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: false), - NormalizedUserName = table.Column(maxLength: 256, nullable: false), - Name = table.Column(maxLength: 64, nullable: true), - Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: false), - NormalizedEmail = table.Column(maxLength: 256, nullable: false), - EmailConfirmed = table.Column(nullable: false, defaultValue: false), - PasswordHash = table.Column(maxLength: 256, nullable: true), - SecurityStamp = table.Column(maxLength: 256, nullable: false), - IsExternal = table.Column(nullable: false, defaultValue: false), - PhoneNumber = table.Column(maxLength: 16, nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false, defaultValue: false), - TwoFactorEnabled = table.Column(nullable: false, defaultValue: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false, defaultValue: false), - AccessFailedCount = table.Column(nullable: false, defaultValue: 0) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiResources", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Properties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClients", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - ClientName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 2000, nullable: true), - LogoUri = table.Column(maxLength: 2000, nullable: true), - Enabled = table.Column(nullable: false), - ProtocolType = table.Column(maxLength: 200, nullable: false), - RequireClientSecret = table.Column(nullable: false), - RequireConsent = table.Column(nullable: false), - AllowRememberConsent = table.Column(nullable: false), - AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), - RequirePkce = table.Column(nullable: false), - AllowPlainTextPkce = table.Column(nullable: false), - AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - BackChannelLogoutSessionRequired = table.Column(nullable: false), - AllowOfflineAccess = table.Column(nullable: false), - IdentityTokenLifetime = table.Column(nullable: false), - AccessTokenLifetime = table.Column(nullable: false), - AuthorizationCodeLifetime = table.Column(nullable: false), - ConsentLifetime = table.Column(nullable: true), - AbsoluteRefreshTokenLifetime = table.Column(nullable: false), - SlidingRefreshTokenLifetime = table.Column(nullable: false), - RefreshTokenUsage = table.Column(nullable: false), - UpdateAccessTokenClaimsOnRefresh = table.Column(nullable: false), - RefreshTokenExpiration = table.Column(nullable: false), - AccessTokenType = table.Column(nullable: false), - EnableLocalLogin = table.Column(nullable: false), - IncludeJwtId = table.Column(nullable: false), - AlwaysSendClientClaims = table.Column(nullable: false), - ClientClaimsPrefix = table.Column(maxLength: 200, nullable: true), - PairWiseSubjectSalt = table.Column(maxLength: 200, nullable: true), - UserSsoLifetime = table.Column(nullable: true), - UserCodeType = table.Column(maxLength: 100, nullable: true), - DeviceCodeLifetime = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClients", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerDeviceFlowCodes", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - DeviceCode = table.Column(maxLength: 200, nullable: false), - UserCode = table.Column(maxLength: 200, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - Expiration = table.Column(nullable: false), - Data = table.Column(maxLength: 50000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerIdentityResources", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false), - Properties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerPersistedGrants", - columns: table => new - { - Key = table.Column(maxLength: 200, nullable: false), - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - Type = table.Column(maxLength: 50, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: true), - Data = table.Column(maxLength: 50000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); - }); - - migrationBuilder.CreateTable( - name: "AbpAuditLogActions", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - AuditLogId = table.Column(nullable: false), - ServiceName = table.Column(maxLength: 256, nullable: true), - MethodName = table.Column(maxLength: 128, nullable: true), - Parameters = table.Column(maxLength: 2000, nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); - table.ForeignKey( - name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", - column: x => x.AuditLogId, - principalTable: "AbpAuditLogs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpEntityChanges", - columns: table => new - { - Id = table.Column(nullable: false), - AuditLogId = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ChangeTime = table.Column(nullable: false), - ChangeType = table.Column(nullable: false), - EntityTenantId = table.Column(nullable: true), - EntityId = table.Column(maxLength: 128, nullable: false), - EntityTypeFullName = table.Column(maxLength: 128, nullable: false), - ExtraProperties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); - table.ForeignKey( - name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", - column: x => x.AuditLogId, - principalTable: "AbpAuditLogs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpOrganizationUnitRoles", - columns: table => new - { - RoleId = table.Column(nullable: false), - OrganizationUnitId = table.Column(nullable: false), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - TenantId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpOrganizationUnitRoles", x => new { x.OrganizationUnitId, x.RoleId }); - table.ForeignKey( - name: "FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUnitId", - column: x => x.OrganizationUnitId, - principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AbpOrganizationUnitRoles_AbpRoles_RoleId", - column: x => x.RoleId, - principalTable: "AbpRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpRoleClaims", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - RoleId = table.Column(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: "AbpTenantConnectionStrings", - columns: table => new - { - TenantId = table.Column(nullable: false), - Name = table.Column(maxLength: 64, nullable: false), - Value = table.Column(maxLength: 1024, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); - table.ForeignKey( - name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", - column: x => x.TenantId, - principalTable: "AbpTenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserClaims", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - UserId = table.Column(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 - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - TenantId = table.Column(nullable: true), - ProviderKey = table.Column(maxLength: 196, nullable: false), - ProviderDisplayName = table.Column(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: "AbpUserOrganizationUnits", - columns: table => new - { - UserId = table.Column(nullable: false), - OrganizationUnitId = table.Column(nullable: false), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - TenantId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserOrganizationUnits", x => new { x.OrganizationUnitId, x.UserId }); - table.ForeignKey( - name: "FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUnitId", - column: x => x.OrganizationUnitId, - principalTable: "AbpOrganizationUnits", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AbpUserOrganizationUnits_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserRoles", - columns: table => new - { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false), - TenantId = table.Column(nullable: true) - }, - 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 - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - TenantId = table.Column(nullable: true), - Value = table.Column(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 - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiClaims", x => new { x.ApiResourceId, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiClaims_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiScopes", - columns: table => new - { - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopes", x => new { x.ApiResourceId, x.Name }); - table.ForeignKey( - name: "FK_IdentityServerApiScopes_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiSecrets", - columns: table => new - { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerApiSecrets_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientClaims", - columns: table => new - { - ClientId = table.Column(nullable: false), - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 250, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientCorsOrigins", - columns: table => new - { - ClientId = table.Column(nullable: false), - Origin = table.Column(maxLength: 150, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin }); - table.ForeignKey( - name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientGrantTypes", - columns: table => new - { - ClientId = table.Column(nullable: false), - GrantType = table.Column(maxLength: 250, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType }); - table.ForeignKey( - name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientIdPRestrictions", - columns: table => new - { - ClientId = table.Column(nullable: false), - Provider = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider }); - table.ForeignKey( - name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientPostLogoutRedirectUris", - columns: table => new - { - ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri }); - table.ForeignKey( - name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientProperties", - columns: table => new - { - ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key }); - table.ForeignKey( - name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientRedirectUris", - columns: table => new - { - ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri }); - table.ForeignKey( - name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientScopes", - columns: table => new - { - ClientId = table.Column(nullable: false), - Scope = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope }); - table.ForeignKey( - name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientSecrets", - columns: table => new - { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerIdentityClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - IdentityResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerIdentityClaims", x => new { x.IdentityResourceId, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerIdentityClaims_IdentityServerIdentityResources_IdentityResourceId", - column: x => x.IdentityResourceId, - principalTable: "IdentityServerIdentityResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpEntityPropertyChanges", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - EntityChangeId = table.Column(nullable: false), - NewValue = table.Column(maxLength: 512, nullable: true), - OriginalValue = table.Column(maxLength: 512, nullable: true), - PropertyName = table.Column(maxLength: 128, nullable: false), - PropertyTypeFullName = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); - table.ForeignKey( - name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", - column: x => x.EntityChangeId, - principalTable: "AbpEntityChanges", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiScopeClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiResourceId, x.Name, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiResourceId_Name", - columns: x => new { x.ApiResourceId, x.Name }, - principalTable: "IdentityServerApiScopes", - principalColumns: new[] { "ApiResourceId", "Name" }, - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogActions_AuditLogId", - table: "AbpAuditLogActions", - column: "AuditLogId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", - table: "AbpAuditLogActions", - columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogs_TenantId_ExecutionTime", - table: "AbpAuditLogs", - columns: new[] { "TenantId", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", - table: "AbpAuditLogs", - columns: new[] { "TenantId", "UserId", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityChanges_AuditLogId", - table: "AbpEntityChanges", - column: "AuditLogId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", - table: "AbpEntityChanges", - columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityPropertyChanges_EntityChangeId", - table: "AbpEntityPropertyChanges", - column: "EntityChangeId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", - table: "AbpFeatureValues", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId", - table: "AbpLinkUsers", - columns: new[] { "SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId" }, - unique: true, - filter: "[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", - table: "AbpOrganizationUnitRoles", - columns: new[] { "RoleId", "OrganizationUnitId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpOrganizationUnits_Code", - table: "AbpOrganizationUnits", - column: "Code"); - - migrationBuilder.CreateIndex( - name: "IX_AbpOrganizationUnits_ParentId", - table: "AbpOrganizationUnits", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", - table: "AbpPermissionGrants", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpRoleClaims_RoleId", - table: "AbpRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpRoles_NormalizedName", - table: "AbpRoles", - column: "NormalizedName"); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_Action", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "Action" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_ApplicationName", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "ApplicationName" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_Identity", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "Identity" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSecurityLogs_TenantId_UserId", - table: "AbpSecurityLogs", - columns: new[] { "TenantId", "UserId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpSettings_Name_ProviderName_ProviderKey", - table: "AbpSettings", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpTenants_Name", - table: "AbpTenants", - column: "Name"); - - 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_AbpUserOrganizationUnits_UserId_OrganizationUnitId", - table: "AbpUserOrganizationUnits", - columns: new[] { "UserId", "OrganizationUnitId" }); - - 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_IdentityServerClients_ClientId", - table: "IdentityServerClients", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", - table: "IdentityServerDeviceFlowCodes", - column: "DeviceCode", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerDeviceFlowCodes_Expiration", - table: "IdentityServerDeviceFlowCodes", - column: "Expiration"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerDeviceFlowCodes_UserCode", - table: "IdentityServerDeviceFlowCodes", - column: "UserCode", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerPersistedGrants_Expiration", - table: "IdentityServerPersistedGrants", - column: "Expiration"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", - table: "IdentityServerPersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type" }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AbpAuditLogActions"); - - migrationBuilder.DropTable( - name: "AbpClaimTypes"); - - migrationBuilder.DropTable( - name: "AbpEntityPropertyChanges"); - - migrationBuilder.DropTable( - name: "AbpFeatureValues"); - - migrationBuilder.DropTable( - name: "AbpLinkUsers"); - - migrationBuilder.DropTable( - name: "AbpOrganizationUnitRoles"); - - migrationBuilder.DropTable( - name: "AbpPermissionGrants"); - - migrationBuilder.DropTable( - name: "AbpRoleClaims"); - - migrationBuilder.DropTable( - name: "AbpSecurityLogs"); - - migrationBuilder.DropTable( - name: "AbpSettings"); - - migrationBuilder.DropTable( - name: "AbpTenantConnectionStrings"); - - migrationBuilder.DropTable( - name: "AbpUserClaims"); - - migrationBuilder.DropTable( - name: "AbpUserLogins"); - - migrationBuilder.DropTable( - name: "AbpUserOrganizationUnits"); - - migrationBuilder.DropTable( - name: "AbpUserRoles"); - - migrationBuilder.DropTable( - name: "AbpUserTokens"); - - migrationBuilder.DropTable( - name: "IdentityServerApiClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerApiScopeClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerApiSecrets"); - - migrationBuilder.DropTable( - name: "IdentityServerClientClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerClientCorsOrigins"); - - migrationBuilder.DropTable( - name: "IdentityServerClientGrantTypes"); - - migrationBuilder.DropTable( - name: "IdentityServerClientIdPRestrictions"); - - migrationBuilder.DropTable( - name: "IdentityServerClientPostLogoutRedirectUris"); - - migrationBuilder.DropTable( - name: "IdentityServerClientProperties"); - - migrationBuilder.DropTable( - name: "IdentityServerClientRedirectUris"); - - migrationBuilder.DropTable( - name: "IdentityServerClientScopes"); - - migrationBuilder.DropTable( - name: "IdentityServerClientSecrets"); - - migrationBuilder.DropTable( - name: "IdentityServerDeviceFlowCodes"); - - migrationBuilder.DropTable( - name: "IdentityServerIdentityClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerPersistedGrants"); - - migrationBuilder.DropTable( - name: "AbpEntityChanges"); - - migrationBuilder.DropTable( - name: "AbpTenants"); - - migrationBuilder.DropTable( - name: "AbpOrganizationUnits"); - - migrationBuilder.DropTable( - name: "AbpRoles"); - - migrationBuilder.DropTable( - name: "AbpUsers"); - - migrationBuilder.DropTable( - name: "IdentityServerApiScopes"); - - migrationBuilder.DropTable( - name: "IdentityServerClients"); - - migrationBuilder.DropTable( - name: "IdentityServerIdentityResources"); - - migrationBuilder.DropTable( - name: "AbpAuditLogs"); - - migrationBuilder.DropTable( - name: "IdentityServerApiResources"); - } - } -} diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201013055209_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201019021120_Initial.Designer.cs similarity index 61% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201013055209_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201019021120_Initial.Designer.cs index d8f36ad2ce..0f3b3b90b9 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201013055209_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201019021120_Initial.Designer.cs @@ -11,17 +11,17 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(IdentityServerHostMigrationsDbContext))] - [Migration("20201013055209_Initial")] + [Migration("20201019021120_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder + .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "3.1.8") .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -30,99 +30,99 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") - .HasColumnName("ApplicationName") + .HasMaxLength(96) .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasColumnName("ApplicationName"); b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("BrowserInfo"); b.Property("ClientId") - .HasColumnName("ClientId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientId"); b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientIpAddress"); b.Property("ClientName") - .HasColumnName("ClientName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("ClientName"); b.Property("Comments") - .HasColumnName("Comments") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Comments"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnName("CorrelationId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasColumnName("Exceptions") + .HasMaxLength(4000) .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasColumnName("Exceptions"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("HttpMethod") - .HasColumnName("HttpMethod") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("HttpMethod"); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") .HasColumnType("nvarchar(max)"); b.Property("Url") - .HasColumnName("Url") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Url"); b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); b.Property("UserName") - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -140,39 +140,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("MethodName") - .HasColumnName("MethodName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("MethodName"); b.Property("Parameters") - .HasColumnName("Parameters") + .HasMaxLength(2000) .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnName("Parameters"); b.Property("ServiceName") - .HasColumnName("ServiceName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("ServiceName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -190,39 +190,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); b.Property("EntityId") .IsRequired() - .HasColumnName("EntityId") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityId"); b.Property("EntityTenantId") .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() - .HasColumnName("EntityTypeFullName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityTypeFullName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -243,30 +243,30 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("NewValue") - .HasColumnName("NewValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("NewValue"); b.Property("OriginalValue") - .HasColumnName("OriginalValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("OriginalValue"); b.Property("PropertyName") .IsRequired() - .HasColumnName("PropertyName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("PropertyName"); b.Property("PropertyTypeFullName") .IsRequired() - .HasColumnName("PropertyTypeFullName") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("PropertyTypeFullName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -283,21 +283,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.HasKey("Id"); @@ -314,33 +314,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsStatic") .HasColumnType("bit"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("Regex") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("RegexDescription") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Required") .HasColumnType("bit"); @@ -388,39 +388,39 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDefault") - .HasColumnName("IsDefault") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsDefault"); b.Property("IsPublic") - .HasColumnName("IsPublic") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsPublic"); b.Property("IsStatic") - .HasColumnName("IsStatic") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsStatic"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("NormalizedName") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -436,19 +436,19 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClaimType") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.Property("RoleId") .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -464,60 +464,60 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Action") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("CreationTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("Identity") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("UserId") .HasColumnType("uniqueidentifier"); b.Property("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.HasKey("Id"); @@ -540,136 +540,136 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("AccessFailedCount") .ValueGeneratedOnAdd() - .HasColumnName("AccessFailedCount") .HasColumnType("int") - .HasDefaultValue(0); + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Email") .IsRequired() - .HasColumnName("Email") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Email"); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() - .HasColumnName("EmailConfirmed") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("IsExternal") .ValueGeneratedOnAdd() - .HasColumnName("IsExternal") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsExternal"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() - .HasColumnName("LockoutEnabled") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); b.Property("LockoutEnd") .HasColumnType("datetimeoffset"); b.Property("Name") - .HasColumnName("Name") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("Name"); b.Property("NormalizedEmail") .IsRequired() - .HasColumnName("NormalizedEmail") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("NormalizedEmail"); b.Property("NormalizedUserName") .IsRequired() - .HasColumnName("NormalizedUserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("NormalizedUserName"); b.Property("PasswordHash") - .HasColumnName("PasswordHash") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("PasswordHash"); b.Property("PhoneNumber") - .HasColumnName("PhoneNumber") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("PhoneNumber"); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() - .HasColumnName("PhoneNumberConfirmed") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); b.Property("SecurityStamp") .IsRequired() - .HasColumnName("SecurityStamp") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("SecurityStamp"); b.Property("Surname") - .HasColumnName("Surname") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("Surname"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() - .HasColumnName("TwoFactorEnabled") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); b.Property("UserName") .IsRequired() - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -691,16 +691,16 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClaimType") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("UserId") .HasColumnType("uniqueidentifier"); @@ -718,21 +718,21 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("UserId", "LoginProvider"); @@ -750,16 +750,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("OrganizationUnitId", "UserId"); @@ -777,8 +777,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("UserId", "RoleId"); @@ -793,16 +793,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Name") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("Value") .HasColumnType("nvarchar(max)"); @@ -820,62 +820,62 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Code") .IsRequired() - .HasColumnName("Code") + .HasMaxLength(95) .HasColumnType("nvarchar(95)") - .HasMaxLength(95); + .HasColumnName("Code"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("DisplayName") .IsRequired() - .HasColumnName("DisplayName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("DisplayName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("ParentId") .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -895,16 +895,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("OrganizationUnitId", "RoleId"); @@ -919,67 +919,74 @@ namespace MyCompanyName.MyProjectName.Migrations .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Enabled") .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("Properties") - .HasColumnType("nvarchar(max)"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); + b.HasIndex("Name") + .IsUnique(); + b.ToTable("IdentityServerApiResources"); }); @@ -989,86 +996,180 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ApiResourceId", "Type"); - b.ToTable("IdentityServerApiClaims"); + b.ToTable("IdentityServerApiResourceClaims"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => { b.Property("ApiResourceId") .HasColumnType("uniqueidentifier"); - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Scope") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("ApiResourceId", "Scope"); + + b.ToTable("IdentityServerApiResourceScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiResourceSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Emphasize") .HasColumnType("bit"); + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + b.Property("Required") .HasColumnType("bit"); b.Property("ShowInDiscoveryDocument") .HasColumnType("bit"); - b.HasKey("ApiResourceId", "Name"); + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); b.ToTable("IdentityServerApiScopes"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => { - b.Property("ApiResourceId") + b.Property("ApiScopeId") .HasColumnType("uniqueidentifier"); - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.HasKey("ApiResourceId", "Name", "Type"); + b.HasKey("ApiScopeId", "Type"); b.ToTable("IdentityServerApiScopeClaims"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => { - b.Property("ApiResourceId") + b.Property("ApiScopeId") .HasColumnType("uniqueidentifier"); - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); - b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("Expiration") - .HasColumnType("datetime2"); + b.HasKey("ApiScopeId", "Key", "Value"); - b.HasKey("ApiResourceId", "Type", "Value"); - - b.ToTable("IdentityServerApiSecrets"); + b.ToTable("IdentityServerApiScopeProperties"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => @@ -1098,6 +1199,10 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("AllowRememberConsent") .HasColumnType("bit"); + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + b.Property("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("bit"); @@ -1111,54 +1216,54 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("ClientClaimsPrefix") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ConsentLifetime") .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DeviceCodeLifetime") .HasColumnType("int"); @@ -1170,15 +1275,15 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("FrontChannelLogoutSessionRequired") .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("IdentityTokenLifetime") .HasColumnType("int"); @@ -1188,30 +1293,30 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("LogoUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("PairWiseSubjectSalt") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ProtocolType") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("RefreshTokenExpiration") .HasColumnType("int"); @@ -1228,6 +1333,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("RequirePkce") .HasColumnType("bit"); + b.Property("RequireRequestObject") + .HasColumnType("bit"); + b.Property("SlidingRefreshTokenLifetime") .HasColumnType("int"); @@ -1235,8 +1343,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("UserCodeType") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("UserSsoLifetime") .HasColumnType("int"); @@ -1254,12 +1362,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("ClientId", "Type", "Value"); @@ -1272,8 +1380,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Origin") - .HasColumnType("nvarchar(150)") - .HasMaxLength(150); + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); b.HasKey("ClientId", "Origin"); @@ -1286,8 +1394,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("ClientId", "GrantType"); @@ -1300,8 +1408,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ClientId", "Provider"); @@ -1314,8 +1422,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -1328,15 +1436,14 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); - b.HasKey("ClientId", "Key"); + b.HasKey("ClientId", "Key", "Value"); b.ToTable("IdentityServerClientProperties"); }); @@ -1347,8 +1454,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "RedirectUri"); @@ -1361,8 +1468,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ClientId", "Scope"); @@ -1375,16 +1482,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1402,49 +1509,57 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("Data") .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("DeviceCode") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Expiration") .IsRequired() .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("UserCode") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -1453,8 +1568,7 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("Expiration"); - b.HasIndex("UserCode") - .IsUnique(); + b.HasIndex("UserCode"); b.ToTable("IdentityServerDeviceFlowCodes"); }); @@ -1462,46 +1576,57 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsumedTime") + .HasColumnType("datetime2"); b.Property("CreationTime") .HasColumnType("datetime2"); b.Property("Data") .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Expiration") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Type") .IsRequired() - .HasColumnType("nvarchar(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); b.HasKey("Key"); @@ -1509,21 +1634,9 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasIndex("SubjectId", "ClientId", "Type"); - b.ToTable("IdentityServerPersistedGrants"); - }); + b.HasIndex("SubjectId", "SessionId", "Type"); - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => - { - b.Property("IdentityResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("IdentityResourceId", "Type"); - - b.ToTable("IdentityServerIdentityClaims"); + b.ToTable("IdentityServerPersistedGrants"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => @@ -1534,33 +1647,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Emphasize") .HasColumnType("bit"); @@ -1569,30 +1682,27 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Properties") - .HasColumnType("nvarchar(max)"); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Required") .HasColumnType("bit"); @@ -1602,9 +1712,44 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Id"); + b.HasIndex("Name") + .IsUnique(); + b.ToTable("IdentityServerIdentityResources"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityResourceClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("IdentityResourceId", "Key", "Value"); + + b.ToTable("IdentityServerIdentityResourceProperties"); + }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") @@ -1613,22 +1758,22 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -1645,21 +1790,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); b.HasKey("Id"); @@ -1676,48 +1821,48 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.HasKey("Id"); @@ -1732,13 +1877,13 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.HasKey("TenantId", "Name"); @@ -1869,25 +2014,25 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => { b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Scopes") + .WithMany("Properties") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) - .WithMany("UserClaims") - .HasForeignKey("ApiResourceId", "Name") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Scopes") + .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => { b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") @@ -1896,6 +2041,24 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("UserClaims") + .HasForeignKey("ApiScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("Properties") + .HasForeignKey("ApiScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) @@ -1977,7 +2140,7 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => { b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) .WithMany("UserClaims") @@ -1986,6 +2149,15 @@ namespace MyCompanyName.MyProjectName.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("Properties") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { b.HasOne("Volo.Abp.TenantManagement.Tenant", null) @@ -1994,6 +2166,92 @@ namespace MyCompanyName.MyProjectName.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); #pragma warning restore 612, 618 } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200909022225_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201019021120_Initial.cs similarity index 53% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200909022225_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201019021120_Initial.cs index 5677db545a..2296a18f25 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200909022225_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201019021120_Initial.cs @@ -11,28 +11,28 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpAuditLogs", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantId = table.Column(nullable: true), - TenantName = table.Column(nullable: true), - ImpersonatorUserId = table.Column(nullable: true), - ImpersonatorTenantId = table.Column(nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - ClientName = table.Column(maxLength: 128, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - HttpMethod = table.Column(maxLength: 16, nullable: true), - Url = table.Column(maxLength: 256, nullable: true), - Exceptions = table.Column(maxLength: 4000, nullable: true), - Comments = table.Column(maxLength: 256, nullable: true), - HttpStatusCode = table.Column(nullable: true) + Id = table.Column(type: "uniqueidentifier", nullable: false), + ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + TenantName = table.Column(type: "nvarchar(max)", nullable: true), + ImpersonatorUserId = table.Column(type: "uniqueidentifier", nullable: true), + ImpersonatorTenantId = table.Column(type: "uniqueidentifier", nullable: true), + ExecutionTime = table.Column(type: "datetime2", nullable: false), + ExecutionDuration = table.Column(type: "int", nullable: false), + ClientIpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ClientName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + ClientId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + CorrelationId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + HttpMethod = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + Exceptions = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true), + Comments = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + HttpStatusCode = table.Column(type: "int", nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) }, constraints: table => { @@ -40,79 +40,73 @@ namespace MyCompanyName.MyProjectName.Migrations }); migrationBuilder.CreateTable( - name: "AbpBackgroundJobs", + name: "AbpClaimTypes", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - JobName = table.Column(maxLength: 128, nullable: false), - JobArgs = table.Column(maxLength: 1048576, nullable: false), - TryCount = table.Column(nullable: false, defaultValue: (short)0), - CreationTime = table.Column(nullable: false), - NextTryTime = table.Column(nullable: false), - LastTryTime = table.Column(nullable: true), - IsAbandoned = table.Column(nullable: false, defaultValue: false), - Priority = table.Column(nullable: false, defaultValue: (byte)15) + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Required = table.Column(type: "bit", nullable: false), + IsStatic = table.Column(type: "bit", nullable: false), + Regex = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + RegexDescription = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Description = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ValueType = table.Column(type: "int", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) }, constraints: table => { - table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); + table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); }); migrationBuilder.CreateTable( - name: "AbpClaimTypes", + name: "AbpFeatureValues", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - Name = table.Column(maxLength: 256, nullable: false), - Required = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - Regex = table.Column(maxLength: 512, nullable: true), - RegexDescription = table.Column(maxLength: 128, nullable: true), - Description = table.Column(maxLength: 256, nullable: true), - ValueType = table.Column(nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Value = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true) }, constraints: table => { - table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); + table.PrimaryKey("PK_AbpFeatureValues", x => x.Id); }); migrationBuilder.CreateTable( - name: "AbpFeatureValues", + name: "AbpLinkUsers", columns: table => new { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) + Id = table.Column(type: "uniqueidentifier", nullable: false), + SourceUserId = table.Column(type: "uniqueidentifier", nullable: false), + SourceTenantId = table.Column(type: "uniqueidentifier", nullable: true), + TargetUserId = table.Column(type: "uniqueidentifier", nullable: false), + TargetTenantId = table.Column(type: "uniqueidentifier", nullable: true) }, constraints: table => { - table.PrimaryKey("PK_AbpFeatureValues", x => x.Id); + table.PrimaryKey("PK_AbpLinkUsers", x => x.Id); }); migrationBuilder.CreateTable( name: "AbpOrganizationUnits", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - TenantId = table.Column(nullable: true), - ParentId = table.Column(nullable: true), - Code = table.Column(maxLength: 95, nullable: false), - DisplayName = table.Column(maxLength: 128, nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ParentId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(95)", maxLength: 95, nullable: false), + DisplayName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -129,11 +123,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpPermissionGrants", columns: table => new { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: false), - ProviderKey = table.Column(maxLength: 64, nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false) }, constraints: table => { @@ -144,15 +138,15 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpRoles", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 256, nullable: false), - NormalizedName = table.Column(maxLength: 256, nullable: false), - IsDefault = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - IsPublic = table.Column(nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + IsDefault = table.Column(type: "bit", nullable: false), + IsStatic = table.Column(type: "bit", nullable: false), + IsPublic = table.Column(type: "bit", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) }, constraints: table => { @@ -163,21 +157,21 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpSecurityLogs", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - TenantId = table.Column(nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - Identity = table.Column(maxLength: 96, nullable: true), - Action = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantName = table.Column(maxLength: 64, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - CreationTime = table.Column(nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + Identity = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + Action = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + TenantName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ClientId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + CorrelationId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ClientIpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) }, constraints: table => { @@ -188,11 +182,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpSettings", columns: table => new { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 2048, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Value = table.Column(type: "nvarchar(2048)", maxLength: 2048, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true) }, constraints: table => { @@ -203,17 +197,17 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpTenants", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 64, nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -224,33 +218,33 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpUsers", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - TenantId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: false), - NormalizedUserName = table.Column(maxLength: 256, nullable: false), - Name = table.Column(maxLength: 64, nullable: true), - Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: false), - NormalizedEmail = table.Column(maxLength: 256, nullable: false), - EmailConfirmed = table.Column(nullable: false, defaultValue: false), - PasswordHash = table.Column(maxLength: 256, nullable: true), - SecurityStamp = table.Column(maxLength: 256, nullable: false), - IsExternal = table.Column(nullable: false, defaultValue: false), - PhoneNumber = table.Column(maxLength: 16, nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false, defaultValue: false), - TwoFactorEnabled = table.Column(nullable: false, defaultValue: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false, defaultValue: false), - AccessFailedCount = table.Column(nullable: false, defaultValue: 0) + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Surname = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + EmailConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false), + PasswordHash = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + SecurityStamp = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + IsExternal = table.Column(type: "bit", nullable: false, defaultValue: false), + PhoneNumber = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + PhoneNumberConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false), + TwoFactorEnabled = table.Column(type: "bit", nullable: false, defaultValue: false), + LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), + LockoutEnabled = table.Column(type: "bit", nullable: false, defaultValue: false), + AccessFailedCount = table.Column(type: "int", nullable: false, defaultValue: 0), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -261,22 +255,22 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiResources", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - AllowedAccessTokenSigningAlgorithms = table.Column(maxLength: 100, nullable: true), - ShowInDiscoveryDocument = table.Column(nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Enabled = table.Column(type: "bit", nullable: false), + AllowedAccessTokenSigningAlgorithms = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -287,23 +281,23 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiScopes", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Enabled = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + Enabled = table.Column(type: "bit", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Required = table.Column(type: "bit", nullable: false), + Emphasize = table.Column(type: "bit", nullable: false), + ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -314,55 +308,55 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClients", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - ClientName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 2000, nullable: true), - LogoUri = table.Column(maxLength: 2000, nullable: true), - Enabled = table.Column(nullable: false), - ProtocolType = table.Column(maxLength: 200, nullable: false), - RequireClientSecret = table.Column(nullable: false), - RequireConsent = table.Column(nullable: false), - AllowRememberConsent = table.Column(nullable: false), - AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), - RequirePkce = table.Column(nullable: false), - AllowPlainTextPkce = table.Column(nullable: false), - RequireRequestObject = table.Column(nullable: false), - AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - BackChannelLogoutSessionRequired = table.Column(nullable: false), - AllowOfflineAccess = table.Column(nullable: false), - IdentityTokenLifetime = table.Column(nullable: false), - AllowedIdentityTokenSigningAlgorithms = table.Column(maxLength: 100, nullable: true), - AccessTokenLifetime = table.Column(nullable: false), - AuthorizationCodeLifetime = table.Column(nullable: false), - ConsentLifetime = table.Column(nullable: true), - AbsoluteRefreshTokenLifetime = table.Column(nullable: false), - SlidingRefreshTokenLifetime = table.Column(nullable: false), - RefreshTokenUsage = table.Column(nullable: false), - UpdateAccessTokenClaimsOnRefresh = table.Column(nullable: false), - RefreshTokenExpiration = table.Column(nullable: false), - AccessTokenType = table.Column(nullable: false), - EnableLocalLogin = table.Column(nullable: false), - IncludeJwtId = table.Column(nullable: false), - AlwaysSendClientClaims = table.Column(nullable: false), - ClientClaimsPrefix = table.Column(maxLength: 200, nullable: true), - PairWiseSubjectSalt = table.Column(maxLength: 200, nullable: true), - UserSsoLifetime = table.Column(nullable: true), - UserCodeType = table.Column(maxLength: 100, nullable: true), - DeviceCodeLifetime = table.Column(nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ClientName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + ClientUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + LogoUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + Enabled = table.Column(type: "bit", nullable: false), + ProtocolType = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + RequireClientSecret = table.Column(type: "bit", nullable: false), + RequireConsent = table.Column(type: "bit", nullable: false), + AllowRememberConsent = table.Column(type: "bit", nullable: false), + AlwaysIncludeUserClaimsInIdToken = table.Column(type: "bit", nullable: false), + RequirePkce = table.Column(type: "bit", nullable: false), + AllowPlainTextPkce = table.Column(type: "bit", nullable: false), + RequireRequestObject = table.Column(type: "bit", nullable: false), + AllowAccessTokensViaBrowser = table.Column(type: "bit", nullable: false), + FrontChannelLogoutUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + FrontChannelLogoutSessionRequired = table.Column(type: "bit", nullable: false), + BackChannelLogoutUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + BackChannelLogoutSessionRequired = table.Column(type: "bit", nullable: false), + AllowOfflineAccess = table.Column(type: "bit", nullable: false), + IdentityTokenLifetime = table.Column(type: "int", nullable: false), + AllowedIdentityTokenSigningAlgorithms = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + AccessTokenLifetime = table.Column(type: "int", nullable: false), + AuthorizationCodeLifetime = table.Column(type: "int", nullable: false), + ConsentLifetime = table.Column(type: "int", nullable: true), + AbsoluteRefreshTokenLifetime = table.Column(type: "int", nullable: false), + SlidingRefreshTokenLifetime = table.Column(type: "int", nullable: false), + RefreshTokenUsage = table.Column(type: "int", nullable: false), + UpdateAccessTokenClaimsOnRefresh = table.Column(type: "bit", nullable: false), + RefreshTokenExpiration = table.Column(type: "int", nullable: false), + AccessTokenType = table.Column(type: "int", nullable: false), + EnableLocalLogin = table.Column(type: "bit", nullable: false), + IncludeJwtId = table.Column(type: "bit", nullable: false), + AlwaysSendClientClaims = table.Column(type: "bit", nullable: false), + ClientClaimsPrefix = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + PairWiseSubjectSalt = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + UserSsoLifetime = table.Column(type: "int", nullable: true), + UserCodeType = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + DeviceCodeLifetime = table.Column(type: "int", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -373,19 +367,19 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerDeviceFlowCodes", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - DeviceCode = table.Column(maxLength: 200, nullable: false), - UserCode = table.Column(maxLength: 200, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - SessionId = table.Column(maxLength: 100, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - Description = table.Column(maxLength: 200, nullable: true), - Expiration = table.Column(nullable: false), - Data = table.Column(maxLength: 50000, nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + DeviceCode = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + UserCode = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + SubjectId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + SessionId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Expiration = table.Column(type: "datetime2", nullable: false), + Data = table.Column(type: "nvarchar(max)", maxLength: 50000, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true) }, constraints: table => { @@ -396,23 +390,23 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerIdentityResources", columns: table => new { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Enabled = table.Column(type: "bit", nullable: false), + Required = table.Column(type: "bit", nullable: false), + Emphasize = table.Column(type: "bit", nullable: false), + ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -423,19 +417,19 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerPersistedGrants", columns: table => new { - Key = table.Column(maxLength: 200, nullable: false), - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), - Type = table.Column(maxLength: 50, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - SessionId = table.Column(maxLength: 100, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - Description = table.Column(maxLength: 200, nullable: true), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: true), - ConsumedTime = table.Column(nullable: true), - Data = table.Column(maxLength: 50000, nullable: false) + Key = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Type = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + SubjectId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + SessionId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + Expiration = table.Column(type: "datetime2", nullable: true), + ConsumedTime = table.Column(type: "datetime2", nullable: true), + Data = table.Column(type: "nvarchar(max)", maxLength: 50000, nullable: false), + Id = table.Column(type: "uniqueidentifier", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) }, constraints: table => { @@ -446,15 +440,15 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpAuditLogActions", columns: table => new { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - AuditLogId = table.Column(nullable: false), - ServiceName = table.Column(maxLength: 256, nullable: true), - MethodName = table.Column(maxLength: 128, nullable: true), - Parameters = table.Column(maxLength: 2000, nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true) + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + AuditLogId = table.Column(type: "uniqueidentifier", nullable: false), + ServiceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + MethodName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Parameters = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + ExecutionTime = table.Column(type: "datetime2", nullable: false), + ExecutionDuration = table.Column(type: "int", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -471,15 +465,15 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpEntityChanges", columns: table => new { - Id = table.Column(nullable: false), - AuditLogId = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ChangeTime = table.Column(nullable: false), - ChangeType = table.Column(nullable: false), - EntityTenantId = table.Column(nullable: true), - EntityId = table.Column(maxLength: 128, nullable: false), - EntityTypeFullName = table.Column(maxLength: 128, nullable: false), - ExtraProperties = table.Column(nullable: true) + Id = table.Column(type: "uniqueidentifier", nullable: false), + AuditLogId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ChangeTime = table.Column(type: "datetime2", nullable: false), + ChangeType = table.Column(type: "tinyint", nullable: false), + EntityTenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + EntityTypeFullName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -496,11 +490,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpOrganizationUnitRoles", columns: table => new { - RoleId = table.Column(nullable: false), - OrganizationUnitId = table.Column(nullable: false), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - TenantId = table.Column(nullable: true) + RoleId = table.Column(type: "uniqueidentifier", nullable: false), + OrganizationUnitId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true) }, constraints: table => { @@ -523,11 +517,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpRoleClaims", columns: table => new { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - RoleId = table.Column(nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + RoleId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ClaimType = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ClaimValue = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true) }, constraints: table => { @@ -544,9 +538,9 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpTenantConnectionStrings", columns: table => new { - TenantId = table.Column(nullable: false), - Name = table.Column(maxLength: 64, nullable: false), - Value = table.Column(maxLength: 1024, nullable: false) + TenantId = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Value = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: false) }, constraints: table => { @@ -563,11 +557,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpUserClaims", columns: table => new { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - UserId = table.Column(nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ClaimType = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ClaimValue = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true) }, constraints: table => { @@ -584,11 +578,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpUserLogins", columns: table => new { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - TenantId = table.Column(nullable: true), - ProviderKey = table.Column(maxLength: 196, nullable: false), - ProviderDisplayName = table.Column(maxLength: 128, nullable: true) + UserId = table.Column(type: "uniqueidentifier", nullable: false), + LoginProvider = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ProviderKey = table.Column(type: "nvarchar(196)", maxLength: 196, nullable: false), + ProviderDisplayName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true) }, constraints: table => { @@ -605,11 +599,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpUserOrganizationUnits", columns: table => new { - UserId = table.Column(nullable: false), - OrganizationUnitId = table.Column(nullable: false), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - TenantId = table.Column(nullable: true) + UserId = table.Column(type: "uniqueidentifier", nullable: false), + OrganizationUnitId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true) }, constraints: table => { @@ -632,9 +626,9 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpUserRoles", columns: table => new { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false), - TenantId = table.Column(nullable: true) + UserId = table.Column(type: "uniqueidentifier", nullable: false), + RoleId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true) }, constraints: table => { @@ -657,11 +651,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpUserTokens", columns: table => new { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - TenantId = table.Column(nullable: true), - Value = table.Column(nullable: true) + UserId = table.Column(type: "uniqueidentifier", nullable: false), + LoginProvider = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Value = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -678,8 +672,8 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiResourceClaims", columns: table => new { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false) + Type = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ApiResourceId = table.Column(type: "uniqueidentifier", nullable: false) }, constraints: table => { @@ -696,9 +690,9 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiResourceProperties", columns: table => new { - ApiResourceId = table.Column(nullable: false), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false) + ApiResourceId = table.Column(type: "uniqueidentifier", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) }, constraints: table => { @@ -715,8 +709,8 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiResourceScopes", columns: table => new { - ApiResourceId = table.Column(nullable: false), - Scope = table.Column(maxLength: 200, nullable: false) + ApiResourceId = table.Column(type: "uniqueidentifier", nullable: false), + Scope = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) }, constraints: table => { @@ -733,11 +727,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiResourceSecrets", columns: table => new { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 1000, nullable: true), - Expiration = table.Column(nullable: true) + Type = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: false), + ApiResourceId = table.Column(type: "uniqueidentifier", nullable: false), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Expiration = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -754,8 +748,8 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiScopeClaims", columns: table => new { - Type = table.Column(maxLength: 200, nullable: false), - ApiScopeId = table.Column(nullable: false) + Type = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ApiScopeId = table.Column(type: "uniqueidentifier", nullable: false) }, constraints: table => { @@ -772,9 +766,9 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiScopeProperties", columns: table => new { - ApiScopeId = table.Column(nullable: false), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false) + ApiScopeId = table.Column(type: "uniqueidentifier", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) }, constraints: table => { @@ -791,9 +785,9 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientClaims", columns: table => new { - ClientId = table.Column(nullable: false), - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 250, nullable: false) + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Type = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false) }, constraints: table => { @@ -810,8 +804,8 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientCorsOrigins", columns: table => new { - ClientId = table.Column(nullable: false), - Origin = table.Column(maxLength: 150, nullable: false) + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Origin = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: false) }, constraints: table => { @@ -828,8 +822,8 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientGrantTypes", columns: table => new { - ClientId = table.Column(nullable: false), - GrantType = table.Column(maxLength: 250, nullable: false) + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + GrantType = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false) }, constraints: table => { @@ -846,8 +840,8 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientIdPRestrictions", columns: table => new { - ClientId = table.Column(nullable: false), - Provider = table.Column(maxLength: 200, nullable: false) + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Provider = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) }, constraints: table => { @@ -864,8 +858,8 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientPostLogoutRedirectUris", columns: table => new { - ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + PostLogoutRedirectUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) }, constraints: table => { @@ -882,9 +876,9 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientProperties", columns: table => new { - ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false) + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) }, constraints: table => { @@ -901,8 +895,8 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientRedirectUris", columns: table => new { - ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 2000, nullable: false) + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + RedirectUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) }, constraints: table => { @@ -919,8 +913,8 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientScopes", columns: table => new { - ClientId = table.Column(nullable: false), - Scope = table.Column(maxLength: 200, nullable: false) + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Scope = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) }, constraints: table => { @@ -937,11 +931,11 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientSecrets", columns: table => new { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) + Type = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: false), + ClientId = table.Column(type: "uniqueidentifier", nullable: false), + Description = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + Expiration = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -958,8 +952,8 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerIdentityResourceClaims", columns: table => new { - Type = table.Column(maxLength: 200, nullable: false), - IdentityResourceId = table.Column(nullable: false) + Type = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + IdentityResourceId = table.Column(type: "uniqueidentifier", nullable: false) }, constraints: table => { @@ -976,9 +970,9 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerIdentityResourceProperties", columns: table => new { - IdentityResourceId = table.Column(nullable: false), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false) + IdentityResourceId = table.Column(type: "uniqueidentifier", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) }, constraints: table => { @@ -995,13 +989,13 @@ namespace MyCompanyName.MyProjectName.Migrations name: "AbpEntityPropertyChanges", columns: table => new { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - EntityChangeId = table.Column(nullable: false), - NewValue = table.Column(maxLength: 512, nullable: true), - OriginalValue = table.Column(maxLength: 512, nullable: true), - PropertyName = table.Column(maxLength: 128, nullable: false), - PropertyTypeFullName = table.Column(maxLength: 64, nullable: false) + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityChangeId = table.Column(type: "uniqueidentifier", nullable: false), + NewValue = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + OriginalValue = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + PropertyName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + PropertyTypeFullName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false) }, constraints: table => { @@ -1034,11 +1028,6 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpAuditLogs", columns: new[] { "TenantId", "UserId", "ExecutionTime" }); - migrationBuilder.CreateIndex( - name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", - table: "AbpBackgroundJobs", - columns: new[] { "IsAbandoned", "NextTryTime" }); - migrationBuilder.CreateIndex( name: "IX_AbpEntityChanges_AuditLogId", table: "AbpEntityChanges", @@ -1059,6 +1048,13 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpFeatureValues", columns: new[] { "Name", "ProviderName", "ProviderKey" }); + migrationBuilder.CreateIndex( + name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId", + table: "AbpLinkUsers", + columns: new[] { "SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId" }, + unique: true, + filter: "[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + migrationBuilder.CreateIndex( name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", table: "AbpOrganizationUnitRoles", @@ -1219,9 +1215,6 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpAuditLogActions"); - migrationBuilder.DropTable( - name: "AbpBackgroundJobs"); - migrationBuilder.DropTable( name: "AbpClaimTypes"); @@ -1231,6 +1224,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpFeatureValues"); + migrationBuilder.DropTable( + name: "AbpLinkUsers"); + migrationBuilder.DropTable( name: "AbpOrganizationUnitRoles"); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs index 3fcfd093ef..beb40e7827 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs @@ -16,10 +16,10 @@ namespace MyCompanyName.MyProjectName.Migrations { #pragma warning disable 612, 618 modelBuilder + .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "3.1.8") .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -28,99 +28,99 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") - .HasColumnName("ApplicationName") + .HasMaxLength(96) .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasColumnName("ApplicationName"); b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("BrowserInfo"); b.Property("ClientId") - .HasColumnName("ClientId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientId"); b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientIpAddress"); b.Property("ClientName") - .HasColumnName("ClientName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("ClientName"); b.Property("Comments") - .HasColumnName("Comments") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Comments"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnName("CorrelationId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasColumnName("Exceptions") + .HasMaxLength(4000) .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasColumnName("Exceptions"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("HttpMethod") - .HasColumnName("HttpMethod") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("HttpMethod"); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") .HasColumnType("nvarchar(max)"); b.Property("Url") - .HasColumnName("Url") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Url"); b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); b.Property("UserName") - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -138,39 +138,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("MethodName") - .HasColumnName("MethodName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("MethodName"); b.Property("Parameters") - .HasColumnName("Parameters") + .HasMaxLength(2000) .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnName("Parameters"); b.Property("ServiceName") - .HasColumnName("ServiceName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("ServiceName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -188,39 +188,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); b.Property("EntityId") .IsRequired() - .HasColumnName("EntityId") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityId"); b.Property("EntityTenantId") .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() - .HasColumnName("EntityTypeFullName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityTypeFullName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -241,30 +241,30 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("NewValue") - .HasColumnName("NewValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("NewValue"); b.Property("OriginalValue") - .HasColumnName("OriginalValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("OriginalValue"); b.Property("PropertyName") .IsRequired() - .HasColumnName("PropertyName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("PropertyName"); b.Property("PropertyTypeFullName") .IsRequired() - .HasColumnName("PropertyTypeFullName") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("PropertyTypeFullName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -281,21 +281,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.HasKey("Id"); @@ -312,33 +312,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsStatic") .HasColumnType("bit"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("Regex") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("RegexDescription") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Required") .HasColumnType("bit"); @@ -386,39 +386,39 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDefault") - .HasColumnName("IsDefault") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsDefault"); b.Property("IsPublic") - .HasColumnName("IsPublic") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsPublic"); b.Property("IsStatic") - .HasColumnName("IsStatic") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsStatic"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("NormalizedName") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -434,19 +434,19 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClaimType") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.Property("RoleId") .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -462,60 +462,60 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Action") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("CreationTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("Identity") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("UserId") .HasColumnType("uniqueidentifier"); b.Property("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.HasKey("Id"); @@ -538,136 +538,136 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("AccessFailedCount") .ValueGeneratedOnAdd() - .HasColumnName("AccessFailedCount") .HasColumnType("int") - .HasDefaultValue(0); + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Email") .IsRequired() - .HasColumnName("Email") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Email"); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() - .HasColumnName("EmailConfirmed") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("IsExternal") .ValueGeneratedOnAdd() - .HasColumnName("IsExternal") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsExternal"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() - .HasColumnName("LockoutEnabled") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); b.Property("LockoutEnd") .HasColumnType("datetimeoffset"); b.Property("Name") - .HasColumnName("Name") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("Name"); b.Property("NormalizedEmail") .IsRequired() - .HasColumnName("NormalizedEmail") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("NormalizedEmail"); b.Property("NormalizedUserName") .IsRequired() - .HasColumnName("NormalizedUserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("NormalizedUserName"); b.Property("PasswordHash") - .HasColumnName("PasswordHash") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("PasswordHash"); b.Property("PhoneNumber") - .HasColumnName("PhoneNumber") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("PhoneNumber"); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() - .HasColumnName("PhoneNumberConfirmed") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); b.Property("SecurityStamp") .IsRequired() - .HasColumnName("SecurityStamp") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("SecurityStamp"); b.Property("Surname") - .HasColumnName("Surname") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("Surname"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() - .HasColumnName("TwoFactorEnabled") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); b.Property("UserName") .IsRequired() - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -689,16 +689,16 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClaimType") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("UserId") .HasColumnType("uniqueidentifier"); @@ -716,21 +716,21 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("UserId", "LoginProvider"); @@ -748,16 +748,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("OrganizationUnitId", "UserId"); @@ -775,8 +775,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("UserId", "RoleId"); @@ -791,16 +791,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Name") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("Value") .HasColumnType("nvarchar(max)"); @@ -818,62 +818,62 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Code") .IsRequired() - .HasColumnName("Code") + .HasMaxLength(95) .HasColumnType("nvarchar(95)") - .HasMaxLength(95); + .HasColumnName("Code"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("DisplayName") .IsRequired() - .HasColumnName("DisplayName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("DisplayName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("ParentId") .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -893,16 +893,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("OrganizationUnitId", "RoleId"); @@ -918,64 +918,64 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AllowedAccessTokenSigningAlgorithms") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Enabled") .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ShowInDiscoveryDocument") .HasColumnType("bit"); @@ -994,8 +994,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ApiResourceId", "Type"); @@ -1008,12 +1008,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ApiResourceId", "Key", "Value"); @@ -1026,8 +1026,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ApiResourceId", "Scope"); @@ -1040,16 +1040,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1067,33 +1067,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Emphasize") .HasColumnType("bit"); @@ -1102,27 +1102,27 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Required") .HasColumnType("bit"); @@ -1144,8 +1144,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ApiScopeId", "Type"); @@ -1158,12 +1158,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ApiScopeId", "Key", "Value"); @@ -1198,8 +1198,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("AllowedIdentityTokenSigningAlgorithms") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("bit"); @@ -1214,54 +1214,54 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("ClientClaimsPrefix") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ConsentLifetime") .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DeviceCodeLifetime") .HasColumnType("int"); @@ -1273,15 +1273,15 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("FrontChannelLogoutSessionRequired") .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("IdentityTokenLifetime") .HasColumnType("int"); @@ -1291,30 +1291,30 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("LogoUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("PairWiseSubjectSalt") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ProtocolType") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("RefreshTokenExpiration") .HasColumnType("int"); @@ -1341,8 +1341,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("UserCodeType") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("UserSsoLifetime") .HasColumnType("int"); @@ -1360,12 +1360,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("ClientId", "Type", "Value"); @@ -1378,8 +1378,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Origin") - .HasColumnType("nvarchar(150)") - .HasMaxLength(150); + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); b.HasKey("ClientId", "Origin"); @@ -1392,8 +1392,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("ClientId", "GrantType"); @@ -1406,8 +1406,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ClientId", "Provider"); @@ -1420,8 +1420,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -1434,12 +1434,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "Key", "Value"); @@ -1452,8 +1452,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("ClientId", "RedirectUri"); @@ -1466,8 +1466,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("ClientId", "Scope"); @@ -1480,16 +1480,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1507,57 +1507,57 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("Data") .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); b.Property("Description") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("DeviceCode") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Expiration") .IsRequired() .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("SessionId") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("UserCode") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -1574,19 +1574,19 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ConsumedTime") .HasColumnType("datetime2"); @@ -1596,35 +1596,35 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Data") .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); b.Property("Description") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Expiration") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("Id") .HasColumnType("uniqueidentifier"); b.Property("SessionId") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Type") .IsRequired() - .HasColumnType("nvarchar(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); b.HasKey("Key"); @@ -1645,33 +1645,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Emphasize") .HasColumnType("bit"); @@ -1680,27 +1680,27 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Required") .HasColumnType("bit"); @@ -1722,8 +1722,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("IdentityResourceId", "Type"); @@ -1736,12 +1736,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("IdentityResourceId", "Key", "Value"); @@ -1756,22 +1756,22 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -1788,21 +1788,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); b.HasKey("Id"); @@ -1819,48 +1819,48 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.HasKey("Id"); @@ -1875,13 +1875,13 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.HasKey("TenantId", "Name"); @@ -2164,6 +2164,92 @@ namespace MyCompanyName.MyProjectName.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); #pragma warning restore 612, 618 } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201019021101_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201019021101_Initial.Designer.cs new file mode 100644 index 0000000000..cd2f885a7d --- /dev/null +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201019021101_Initial.Designer.cs @@ -0,0 +1,1222 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using MyCompanyName.MyProjectName.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace MyCompanyName.MyProjectName.Migrations +{ + [DbContext(typeof(UnifiedDbContext))] + [Migration("20201019021101_Initial")] + partial class Initial + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)") + .HasColumnName("Exceptions"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201019021101_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201019021101_Initial.cs new file mode 100644 index 0000000000..392499da58 --- /dev/null +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201019021101_Initial.cs @@ -0,0 +1,726 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace MyCompanyName.MyProjectName.Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AbpAuditLogs", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + TenantName = table.Column(type: "nvarchar(max)", nullable: true), + ImpersonatorUserId = table.Column(type: "uniqueidentifier", nullable: true), + ImpersonatorTenantId = table.Column(type: "uniqueidentifier", nullable: true), + ExecutionTime = table.Column(type: "datetime2", nullable: false), + ExecutionDuration = table.Column(type: "int", nullable: false), + ClientIpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ClientName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + ClientId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + CorrelationId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + HttpMethod = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + Exceptions = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true), + Comments = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + HttpStatusCode = table.Column(type: "int", nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpClaimTypes", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Required = table.Column(type: "bit", nullable: false), + IsStatic = table.Column(type: "bit", nullable: false), + Regex = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + RegexDescription = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Description = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ValueType = table.Column(type: "int", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpFeatureValues", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Value = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpFeatureValues", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpLinkUsers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + SourceUserId = table.Column(type: "uniqueidentifier", nullable: false), + SourceTenantId = table.Column(type: "uniqueidentifier", nullable: true), + TargetUserId = table.Column(type: "uniqueidentifier", nullable: false), + TargetTenantId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpLinkUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpOrganizationUnits", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ParentId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(95)", maxLength: 95, nullable: false), + DisplayName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id); + table.ForeignKey( + name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", + column: x => x.ParentId, + principalTable: "AbpOrganizationUnits", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "AbpPermissionGrants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpRoles", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + IsDefault = table.Column(type: "bit", nullable: false), + IsStatic = table.Column(type: "bit", nullable: false), + IsPublic = table.Column(type: "bit", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpSecurityLogs", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ApplicationName = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + Identity = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + Action = table.Column(type: "nvarchar(96)", maxLength: 96, nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + TenantName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ClientId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + CorrelationId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ClientIpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpSettings", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Value = table.Column(type: "nvarchar(2048)", maxLength: 2048, nullable: false), + ProviderName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ProviderKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSettings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpTenants", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpUsers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Surname = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + EmailConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false), + PasswordHash = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + SecurityStamp = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + IsExternal = table.Column(type: "bit", nullable: false, defaultValue: false), + PhoneNumber = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + PhoneNumberConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false), + TwoFactorEnabled = table.Column(type: "bit", nullable: false, defaultValue: false), + LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), + LockoutEnabled = table.Column(type: "bit", nullable: false, defaultValue: false), + AccessFailedCount = table.Column(type: "int", nullable: false, defaultValue: 0), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpAuditLogActions", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + AuditLogId = table.Column(type: "uniqueidentifier", nullable: false), + ServiceName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + MethodName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Parameters = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + ExecutionTime = table.Column(type: "datetime2", nullable: false), + ExecutionDuration = table.Column(type: "int", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); + table.ForeignKey( + name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", + column: x => x.AuditLogId, + principalTable: "AbpAuditLogs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpEntityChanges", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + AuditLogId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ChangeTime = table.Column(type: "datetime2", nullable: false), + ChangeType = table.Column(type: "tinyint", nullable: false), + EntityTenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + EntityTypeFullName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); + table.ForeignKey( + name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", + column: x => x.AuditLogId, + principalTable: "AbpAuditLogs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpOrganizationUnitRoles", + columns: table => new + { + RoleId = table.Column(type: "uniqueidentifier", nullable: false), + OrganizationUnitId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpOrganizationUnitRoles", x => new { x.OrganizationUnitId, x.RoleId }); + table.ForeignKey( + name: "FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUnitId", + column: x => x.OrganizationUnitId, + principalTable: "AbpOrganizationUnits", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AbpOrganizationUnitRoles_AbpRoles_RoleId", + column: x => x.RoleId, + principalTable: "AbpRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpRoleClaims", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + RoleId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ClaimType = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ClaimValue = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true) + }, + 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: "AbpTenantConnectionStrings", + columns: table => new + { + TenantId = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Value = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); + table.ForeignKey( + name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", + column: x => x.TenantId, + principalTable: "AbpTenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserClaims", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ClaimType = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ClaimValue = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true) + }, + 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 + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + LoginProvider = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ProviderKey = table.Column(type: "nvarchar(196)", maxLength: 196, nullable: false), + ProviderDisplayName = table.Column(type: "nvarchar(128)", 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: "AbpUserOrganizationUnits", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + OrganizationUnitId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserOrganizationUnits", x => new { x.OrganizationUnitId, x.UserId }); + table.ForeignKey( + name: "FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUnitId", + column: x => x.OrganizationUnitId, + principalTable: "AbpOrganizationUnits", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AbpUserOrganizationUnits_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserRoles", + columns: table => new + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + RoleId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true) + }, + 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 + { + UserId = table.Column(type: "uniqueidentifier", nullable: false), + LoginProvider = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Value = table.Column(type: "nvarchar(max)", 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: "AbpEntityPropertyChanges", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityChangeId = table.Column(type: "uniqueidentifier", nullable: false), + NewValue = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + OriginalValue = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + PropertyName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + PropertyTypeFullName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); + table.ForeignKey( + name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", + column: x => x.EntityChangeId, + principalTable: "AbpEntityChanges", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogActions_AuditLogId", + table: "AbpAuditLogActions", + column: "AuditLogId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", + table: "AbpAuditLogActions", + columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogs_TenantId_ExecutionTime", + table: "AbpAuditLogs", + columns: new[] { "TenantId", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", + table: "AbpAuditLogs", + columns: new[] { "TenantId", "UserId", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityChanges_AuditLogId", + table: "AbpEntityChanges", + column: "AuditLogId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", + table: "AbpEntityChanges", + columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityPropertyChanges_EntityChangeId", + table: "AbpEntityPropertyChanges", + column: "EntityChangeId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", + table: "AbpFeatureValues", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId", + table: "AbpLinkUsers", + columns: new[] { "SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId" }, + unique: true, + filter: "[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", + table: "AbpOrganizationUnitRoles", + columns: new[] { "RoleId", "OrganizationUnitId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpOrganizationUnits_Code", + table: "AbpOrganizationUnits", + column: "Code"); + + migrationBuilder.CreateIndex( + name: "IX_AbpOrganizationUnits_ParentId", + table: "AbpOrganizationUnits", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + table: "AbpPermissionGrants", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpRoleClaims_RoleId", + table: "AbpRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpRoles_NormalizedName", + table: "AbpRoles", + column: "NormalizedName"); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_Action", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "Action" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_ApplicationName", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "ApplicationName" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_Identity", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "Identity" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSecurityLogs_TenantId_UserId", + table: "AbpSecurityLogs", + columns: new[] { "TenantId", "UserId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpSettings_Name_ProviderName_ProviderKey", + table: "AbpSettings", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpTenants_Name", + table: "AbpTenants", + column: "Name"); + + 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_AbpUserOrganizationUnits_UserId_OrganizationUnitId", + table: "AbpUserOrganizationUnits", + columns: new[] { "UserId", "OrganizationUnitId" }); + + 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: "AbpAuditLogActions"); + + migrationBuilder.DropTable( + name: "AbpClaimTypes"); + + migrationBuilder.DropTable( + name: "AbpEntityPropertyChanges"); + + migrationBuilder.DropTable( + name: "AbpFeatureValues"); + + migrationBuilder.DropTable( + name: "AbpLinkUsers"); + + migrationBuilder.DropTable( + name: "AbpOrganizationUnitRoles"); + + migrationBuilder.DropTable( + name: "AbpPermissionGrants"); + + migrationBuilder.DropTable( + name: "AbpRoleClaims"); + + migrationBuilder.DropTable( + name: "AbpSecurityLogs"); + + migrationBuilder.DropTable( + name: "AbpSettings"); + + migrationBuilder.DropTable( + name: "AbpTenantConnectionStrings"); + + migrationBuilder.DropTable( + name: "AbpUserClaims"); + + migrationBuilder.DropTable( + name: "AbpUserLogins"); + + migrationBuilder.DropTable( + name: "AbpUserOrganizationUnits"); + + migrationBuilder.DropTable( + name: "AbpUserRoles"); + + migrationBuilder.DropTable( + name: "AbpUserTokens"); + + migrationBuilder.DropTable( + name: "AbpEntityChanges"); + + migrationBuilder.DropTable( + name: "AbpTenants"); + + migrationBuilder.DropTable( + name: "AbpOrganizationUnits"); + + migrationBuilder.DropTable( + name: "AbpRoles"); + + migrationBuilder.DropTable( + name: "AbpUsers"); + + migrationBuilder.DropTable( + name: "AbpAuditLogs"); + } + } +} diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index 21d510c82c..7b90b1954f 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -16,10 +16,10 @@ namespace MyCompanyName.MyProjectName.Migrations { #pragma warning disable 612, 618 modelBuilder + .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "3.1.8") .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -28,99 +28,99 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") - .HasColumnName("ApplicationName") + .HasMaxLength(96) .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasColumnName("ApplicationName"); b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("BrowserInfo"); b.Property("ClientId") - .HasColumnName("ClientId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientId"); b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("ClientIpAddress"); b.Property("ClientName") - .HasColumnName("ClientName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("ClientName"); b.Property("Comments") - .HasColumnName("Comments") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Comments"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnName("CorrelationId") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasColumnName("Exceptions") + .HasMaxLength(4000) .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); + .HasColumnName("Exceptions"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("HttpMethod") - .HasColumnName("HttpMethod") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("HttpMethod"); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") .HasColumnType("nvarchar(max)"); b.Property("Url") - .HasColumnName("Url") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Url"); b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); b.Property("UserName") - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -138,39 +138,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("MethodName") - .HasColumnName("MethodName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("MethodName"); b.Property("Parameters") - .HasColumnName("Parameters") + .HasMaxLength(2000) .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .HasColumnName("Parameters"); b.Property("ServiceName") - .HasColumnName("ServiceName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("ServiceName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -188,39 +188,39 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); b.Property("EntityId") .IsRequired() - .HasColumnName("EntityId") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityId"); b.Property("EntityTenantId") .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() - .HasColumnName("EntityTypeFullName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("EntityTypeFullName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -241,30 +241,30 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("NewValue") - .HasColumnName("NewValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("NewValue"); b.Property("OriginalValue") - .HasColumnName("OriginalValue") + .HasMaxLength(512) .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasColumnName("OriginalValue"); b.Property("PropertyName") .IsRequired() - .HasColumnName("PropertyName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("PropertyName"); b.Property("PropertyTypeFullName") .IsRequired() - .HasColumnName("PropertyTypeFullName") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("PropertyTypeFullName"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -281,21 +281,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.HasKey("Id"); @@ -312,33 +312,33 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsStatic") .HasColumnType("bit"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("Regex") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("RegexDescription") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Required") .HasColumnType("bit"); @@ -386,39 +386,39 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDefault") - .HasColumnName("IsDefault") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsDefault"); b.Property("IsPublic") - .HasColumnName("IsPublic") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsPublic"); b.Property("IsStatic") - .HasColumnName("IsStatic") - .HasColumnType("bit"); + .HasColumnType("bit") + .HasColumnName("IsStatic"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("NormalizedName") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -434,19 +434,19 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClaimType") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.Property("RoleId") .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -462,60 +462,60 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Action") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("CreationTime") .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("Identity") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TenantName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("UserId") .HasColumnType("uniqueidentifier"); b.Property("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.HasKey("Id"); @@ -538,136 +538,136 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("AccessFailedCount") .ValueGeneratedOnAdd() - .HasColumnName("AccessFailedCount") .HasColumnType("int") - .HasDefaultValue(0); + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("Email") .IsRequired() - .HasColumnName("Email") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("Email"); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() - .HasColumnName("EmailConfirmed") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("IsExternal") .ValueGeneratedOnAdd() - .HasColumnName("IsExternal") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsExternal"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() - .HasColumnName("LockoutEnabled") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); b.Property("LockoutEnd") .HasColumnType("datetimeoffset"); b.Property("Name") - .HasColumnName("Name") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("Name"); b.Property("NormalizedEmail") .IsRequired() - .HasColumnName("NormalizedEmail") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("NormalizedEmail"); b.Property("NormalizedUserName") .IsRequired() - .HasColumnName("NormalizedUserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("NormalizedUserName"); b.Property("PasswordHash") - .HasColumnName("PasswordHash") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("PasswordHash"); b.Property("PhoneNumber") - .HasColumnName("PhoneNumber") + .HasMaxLength(16) .HasColumnType("nvarchar(16)") - .HasMaxLength(16); + .HasColumnName("PhoneNumber"); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() - .HasColumnName("PhoneNumberConfirmed") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); b.Property("SecurityStamp") .IsRequired() - .HasColumnName("SecurityStamp") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("SecurityStamp"); b.Property("Surname") - .HasColumnName("Surname") + .HasMaxLength(64) .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnName("Surname"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() - .HasColumnName("TwoFactorEnabled") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); b.Property("UserName") .IsRequired() - .HasColumnName("UserName") + .HasMaxLength(256) .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnName("UserName"); b.HasKey("Id"); @@ -689,16 +689,16 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ClaimType") .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("UserId") .HasColumnType("uniqueidentifier"); @@ -716,21 +716,21 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("UserId", "LoginProvider"); @@ -748,16 +748,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("OrganizationUnitId", "UserId"); @@ -775,8 +775,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("UserId", "RoleId"); @@ -791,16 +791,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Name") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.Property("Value") .HasColumnType("nvarchar(max)"); @@ -818,62 +818,62 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Code") .IsRequired() - .HasColumnName("Code") + .HasMaxLength(95) .HasColumnType("nvarchar(95)") - .HasMaxLength(95); + .HasColumnName("Code"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("DisplayName") .IsRequired() - .HasColumnName("DisplayName") + .HasMaxLength(128) .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnName("DisplayName"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("ParentId") .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -893,16 +893,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("OrganizationUnitId", "RoleId"); @@ -919,22 +919,22 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); b.HasKey("Id"); @@ -951,21 +951,21 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); b.HasKey("Id"); @@ -982,48 +982,48 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") + .HasMaxLength(40) .HasColumnType("nvarchar(40)") - .HasMaxLength(40); + .HasColumnName("ConcurrencyStamp"); b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); b.Property("IsDeleted") .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") .HasColumnType("bit") - .HasDefaultValue(false); + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.HasKey("Id"); @@ -1038,13 +1038,13 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); b.HasKey("TenantId", "Name"); @@ -1174,6 +1174,46 @@ namespace MyCompanyName.MyProjectName.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); #pragma warning restore 612, 618 } } From 36a788420bd6edf68a18032516b1d48afb106a56 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 19 Oct 2020 10:53:22 +0800 Subject: [PATCH 32/32] Upgrade IdentityServer4 to 4.1.1 https://github.com/IdentityServer/IdentityServer4/releases/tag/4.1.1 --- .../Volo.Abp.IdentityServer.Domain.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj index 88bf5dfa91..7de8992da6 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj @@ -25,8 +25,8 @@ - - + +