mirror of https://github.com/abpframework/abp.git
18 changed files with 440 additions and 327 deletions
@ -0,0 +1,22 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
|
||||
|
namespace Volo.Abp.Identity.EntityFrameworkCore |
||||
|
{ |
||||
|
public interface IIdentityDbContext : IEfCoreDbContext |
||||
|
{ |
||||
|
DbSet<IdentityUser> Users { get; set; } |
||||
|
|
||||
|
DbSet<IdentityUserClaim> UserClaims { get; set; } |
||||
|
|
||||
|
DbSet<IdentityUserLogin> UserLogins { get; set; } |
||||
|
|
||||
|
DbSet<IdentityUserRole> UserRoles { get; set; } |
||||
|
|
||||
|
DbSet<IdentityUserToken> UserTokens { get; set; } |
||||
|
|
||||
|
DbSet<IdentityRole> Roles { get; set; } |
||||
|
|
||||
|
DbSet<IdentityRoleClaim> RoleClaims { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,108 @@ |
|||||
|
using System; |
||||
|
using JetBrains.Annotations; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
|
||||
|
namespace Volo.Abp.Identity.EntityFrameworkCore |
||||
|
{ |
||||
|
public static class IdentityDbContextModelBuilderExtensions |
||||
|
{ |
||||
|
public static void ConfigureIdentity(this IIdentityDbContext dbContext, ModelBuilder builder, string tablePrefix = "", [CanBeNull] string schema = null) |
||||
|
{ |
||||
|
if (tablePrefix.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
tablePrefix = ""; |
||||
|
} |
||||
|
|
||||
|
builder.Entity<IdentityUser>(b => |
||||
|
{ |
||||
|
b.ToTable(tablePrefix + "Users", schema); |
||||
|
|
||||
|
b.Property(u => u.UserName).IsRequired().HasMaxLength(IdentityUserConsts.MaxUserNameLength); |
||||
|
b.Property(u => u.NormalizedUserName).IsRequired().HasMaxLength(IdentityUserConsts.MaxNormalizedUserNameLength); |
||||
|
b.Property(u => u.Email).HasMaxLength(IdentityUserConsts.MaxEmailLength); |
||||
|
b.Property(u => u.NormalizedEmail).HasMaxLength(IdentityUserConsts.MaxNormalizedEmailLength); |
||||
|
b.Property(u => u.PhoneNumber).HasMaxLength(IdentityUserConsts.MaxPhoneNumberLength); |
||||
|
b.Property(u => u.PasswordHash).HasMaxLength(IdentityUserConsts.MaxPasswordHashLength); |
||||
|
b.Property(u => u.SecurityStamp).IsRequired().HasMaxLength(IdentityUserConsts.MaxSecurityStampLength); |
||||
|
b.Property(u => u.ConcurrencyStamp).IsRequired().HasMaxLength(IdentityUserConsts.MaxConcurrencyStampLength); |
||||
|
b.Property(u => u.EmailConfirmed).HasDefaultValue(false); |
||||
|
b.Property(u => u.PhoneNumberConfirmed).HasDefaultValue(false); |
||||
|
b.Property(u => u.TwoFactorEnabled).HasDefaultValue(false); |
||||
|
b.Property(u => u.LockoutEnabled).HasDefaultValue(false); |
||||
|
b.Property(u => u.AccessFailedCount).HasDefaultValue(0); |
||||
|
|
||||
|
b.HasMany(u => u.Claims).WithOne().HasForeignKey(uc => uc.UserId).IsRequired(); |
||||
|
b.HasMany(u => u.Logins).WithOne().HasForeignKey(ul => ul.UserId).IsRequired(); |
||||
|
b.HasMany(u => u.Roles).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); |
||||
|
b.HasMany(u => u.Tokens).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); |
||||
|
|
||||
|
b.HasIndex(u => u.NormalizedUserName); |
||||
|
b.HasIndex(u => u.NormalizedEmail); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<IdentityRole>(b => |
||||
|
{ |
||||
|
b.ToTable(tablePrefix + "Roles", schema); |
||||
|
|
||||
|
b.Property(r => r.Name).IsRequired().HasMaxLength(IdentityRoleConsts.MaxNameLength); |
||||
|
b.Property(r => r.NormalizedName).IsRequired().HasMaxLength(IdentityRoleConsts.MaxNormalizedNameLength); |
||||
|
|
||||
|
b.HasMany(r => r.Claims).WithOne().HasForeignKey(rc => rc.RoleId).IsRequired(); |
||||
|
|
||||
|
b.HasIndex(r => r.NormalizedName); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<IdentityUserClaim>(b => |
||||
|
{ |
||||
|
b.ToTable(tablePrefix + "UserClaims", schema); |
||||
|
|
||||
|
b.Property(uc => uc.ClaimType).HasMaxLength(IdentityUserClaimConsts.MaxClaimTypeLength).IsRequired(); |
||||
|
b.Property(uc => uc.ClaimValue).HasMaxLength(IdentityUserClaimConsts.MaxClaimValueLength); |
||||
|
|
||||
|
b.HasIndex(uc => uc.UserId); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<IdentityRoleClaim>(b => |
||||
|
{ |
||||
|
b.ToTable(tablePrefix + "RoleClaims", schema); |
||||
|
|
||||
|
b.Property(uc => uc.ClaimType).HasMaxLength(IdentityRoleClaimConsts.MaxClaimTypeLength).IsRequired(); |
||||
|
b.Property(uc => uc.ClaimValue).HasMaxLength(IdentityRoleClaimConsts.MaxClaimValueLength); |
||||
|
|
||||
|
b.HasIndex(uc => uc.RoleId); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<IdentityUserRole>(b => |
||||
|
{ |
||||
|
b.ToTable(tablePrefix + "UserRoles", schema); |
||||
|
|
||||
|
b.HasOne<IdentityRole>().WithMany().HasForeignKey(ur => ur.RoleId).IsRequired(); |
||||
|
b.HasOne<IdentityUser>().WithMany(u => u.Roles).HasForeignKey(ur => ur.UserId).IsRequired(); |
||||
|
|
||||
|
b.HasIndex(ur => new { ur.UserId, ur.RoleId }); |
||||
|
b.HasIndex(ur => new { ur.RoleId, ur.UserId }); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<IdentityUserLogin>(b => |
||||
|
{ |
||||
|
b.ToTable(tablePrefix + "UserLogins", schema); |
||||
|
|
||||
|
b.Property(ul => ul.LoginProvider).HasMaxLength(IdentityUserLoginConsts.MaxLoginProviderLength).IsRequired(); |
||||
|
b.Property(ul => ul.ProviderKey).HasMaxLength(IdentityUserLoginConsts.MaxProviderKeyLength).IsRequired(); |
||||
|
b.Property(ul => ul.ProviderDisplayName).HasMaxLength(IdentityUserLoginConsts.MaxProviderDisplayNameLength); |
||||
|
|
||||
|
b.HasIndex(l => new { l.UserId, l.LoginProvider, l.ProviderKey }); |
||||
|
b.HasIndex(l => new { l.LoginProvider, l.ProviderKey }); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<IdentityUserToken>(b => |
||||
|
{ |
||||
|
b.ToTable(tablePrefix + "UserTokens", schema); |
||||
|
|
||||
|
b.Property(ul => ul.LoginProvider).HasMaxLength(IdentityUserTokenConsts.MaxLoginProviderLength).IsRequired(); |
||||
|
|
||||
|
b.HasIndex(l => new { l.UserId, l.LoginProvider, l.Name }); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Volo.Abp.IdentityServer.ApiResources; |
||||
|
using Volo.Abp.IdentityServer.Clients; |
||||
|
using Volo.Abp.IdentityServer.Grants; |
||||
|
using Volo.Abp.IdentityServer.IdentityResources; |
||||
|
|
||||
|
namespace Volo.Abp.IdentityServer.EntityFrameworkCore |
||||
|
{ |
||||
|
public interface IIdentityServerDbContext : IEfCoreDbContext |
||||
|
{ |
||||
|
DbSet<ApiResource> ApiResources { get; set; } |
||||
|
|
||||
|
DbSet<ApiSecret> ApiSecrets { get; set; } |
||||
|
|
||||
|
DbSet<ApiResourceClaim> ApiResourceClaims { get; set; } |
||||
|
|
||||
|
DbSet<ApiScope> ApiScopes { get; set; } |
||||
|
|
||||
|
DbSet<ApiScopeClaim> ApiScopeClaims { get; set; } |
||||
|
|
||||
|
DbSet<IdentityResource> IdentityResources { get; set; } |
||||
|
|
||||
|
DbSet<IdentityClaim> IdentityClaims { get; set; } |
||||
|
|
||||
|
DbSet<Client> Clients { get; set; } |
||||
|
|
||||
|
DbSet<ClientGrantType> ClientGrantTypes { get; set; } |
||||
|
|
||||
|
DbSet<ClientRedirectUri> ClientRedirectUris { get; set; } |
||||
|
|
||||
|
DbSet<ClientPostLogoutRedirectUri> ClientPostLogoutRedirectUris { get; set; } |
||||
|
|
||||
|
DbSet<ClientScope> ClientScopes { get; set; } |
||||
|
|
||||
|
DbSet<ClientSecret> ClientSecrets { get; set; } |
||||
|
|
||||
|
DbSet<ClientClaim> ClientClaims { get; set; } |
||||
|
|
||||
|
DbSet<ClientIdPRestriction> ClientIdPRestrictions { get; set; } |
||||
|
|
||||
|
DbSet<ClientCorsOrigin> ClientCorsOrigins { get; set; } |
||||
|
|
||||
|
DbSet<ClientProperty> ClientProperties { get; set; } |
||||
|
|
||||
|
DbSet<PersistedGrant> PersistedGrants { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,224 @@ |
|||||
|
using System; |
||||
|
using JetBrains.Annotations; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.IdentityServer.ApiResources; |
||||
|
using Volo.Abp.IdentityServer.Clients; |
||||
|
using Volo.Abp.IdentityServer.Grants; |
||||
|
using Volo.Abp.IdentityServer.IdentityResources; |
||||
|
|
||||
|
namespace Volo.Abp.IdentityServer.EntityFrameworkCore |
||||
|
{ |
||||
|
public static class IdentityServerDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureIdentityServer(this IIdentityServerDbContext dbContext, ModelBuilder builder, string tablePrefix = "", [CanBeNull] string schema = null) |
||||
|
{ |
||||
|
if (tablePrefix.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
tablePrefix = ""; |
||||
|
} |
||||
|
|
||||
|
builder.Entity<Client>(client => |
||||
|
{ |
||||
|
client.ToTable(tablePrefix + "Clients", schema); |
||||
|
|
||||
|
client.Property(x => x.ClientId).HasMaxLength(ClientConsts.ClientIdMaxLength).IsRequired(); |
||||
|
client.Property(x => x.ProtocolType).HasMaxLength(ClientConsts.ProtocolTypeMaxLength).IsRequired(); |
||||
|
client.Property(x => x.ClientName).HasMaxLength(ClientConsts.ClientNameMaxLength); |
||||
|
client.Property(x => x.ClientUri).HasMaxLength(ClientConsts.ClientUriMaxLength); |
||||
|
client.Property(x => x.LogoUri).HasMaxLength(ClientConsts.LogoUriMaxLength); |
||||
|
client.Property(x => x.Description).HasMaxLength(ClientConsts.DescriptionMaxLength); |
||||
|
client.Property(x => x.FrontChannelLogoutUri).HasMaxLength(ClientConsts.FrontChannelLogoutUriMaxLength); |
||||
|
client.Property(x => x.BackChannelLogoutUri).HasMaxLength(ClientConsts.BackChannelLogoutUriMaxLength); |
||||
|
client.Property(x => x.ClientClaimsPrefix).HasMaxLength(ClientConsts.ClientClaimsPrefixMaxLength); |
||||
|
client.Property(x => x.PairWiseSubjectSalt).HasMaxLength(ClientConsts.PairWiseSubjectSaltMaxLength); |
||||
|
|
||||
|
client.HasMany(x => x.AllowedScopes).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); |
||||
|
client.HasMany(x => x.ClientSecrets).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); |
||||
|
client.HasMany(x => x.AllowedGrantTypes).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); |
||||
|
client.HasMany(x => x.AllowedCorsOrigins).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); |
||||
|
client.HasMany(x => x.RedirectUris).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); |
||||
|
client.HasMany(x => x.PostLogoutRedirectUris).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); |
||||
|
client.HasMany(x => x.IdentityProviderRestrictions).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); |
||||
|
client.HasMany(x => x.Claims).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); |
||||
|
client.HasMany(x => x.Properties).WithOne().HasForeignKey(x => x.ClientId).IsRequired(); |
||||
|
|
||||
|
client.HasIndex(x => x.ClientId).IsUnique(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ClientGrantType>(grantType => |
||||
|
{ |
||||
|
grantType.ToTable(tablePrefix + "ClientGrantTypes", schema); |
||||
|
|
||||
|
grantType.HasKey(x => new { x.ClientId, x.GrantType }); |
||||
|
|
||||
|
grantType.Property(x => x.GrantType).HasMaxLength(ClientGrantTypeConsts.GrantTypeMaxLength).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ClientRedirectUri>(redirectUri => |
||||
|
{ |
||||
|
redirectUri.ToTable(tablePrefix + "ClientRedirectUris", schema); |
||||
|
|
||||
|
redirectUri.HasKey(x => new { x.ClientId, x.RedirectUri }); |
||||
|
|
||||
|
redirectUri.Property(x => x.RedirectUri).HasMaxLength(ClientRedirectUriConsts.RedirectUriMaxLength).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ClientPostLogoutRedirectUri>(postLogoutRedirectUri => |
||||
|
{ |
||||
|
postLogoutRedirectUri.ToTable(tablePrefix + "ClientPostLogoutRedirectUris", schema); |
||||
|
|
||||
|
postLogoutRedirectUri.HasKey(x => new { x.ClientId, x.PostLogoutRedirectUri }); |
||||
|
|
||||
|
postLogoutRedirectUri.Property(x => x.PostLogoutRedirectUri).HasMaxLength(ClientPostLogoutRedirectUriConsts.PostLogoutRedirectUriMaxLength).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ClientScope>(scope => |
||||
|
{ |
||||
|
scope.ToTable(tablePrefix + "ClientScopes", schema); |
||||
|
|
||||
|
scope.HasKey(x => new { x.ClientId, x.Scope }); |
||||
|
|
||||
|
scope.Property(x => x.Scope).HasMaxLength(ClientScopeConsts.ScopeMaxLength).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ClientSecret>(secret => |
||||
|
{ |
||||
|
secret.ToTable(tablePrefix + "ClientSecrets", schema); |
||||
|
|
||||
|
secret.HasKey(x => new { x.ClientId, x.Type, x.Value }); |
||||
|
|
||||
|
secret.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired(); |
||||
|
secret.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLength).IsRequired(); |
||||
|
secret.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ClientClaim>(claim => |
||||
|
{ |
||||
|
claim.ToTable(tablePrefix + "ClientClaims", schema); |
||||
|
|
||||
|
claim.Property(x => x.Type).HasMaxLength(ClientClaimConsts.TypeMaxLength).IsRequired(); |
||||
|
claim.Property(x => x.Value).HasMaxLength(ClientClaimConsts.ValueMaxLength).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ClientIdPRestriction>(idPRestriction => |
||||
|
{ |
||||
|
idPRestriction.ToTable(tablePrefix + "ClientIdPRestrictions", schema); |
||||
|
|
||||
|
idPRestriction.HasKey(x => new { x.ClientId, x.Provider }); |
||||
|
|
||||
|
idPRestriction.Property(x => x.Provider).HasMaxLength(ClientIdPRestrictionConsts.ProviderMaxLength).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ClientCorsOrigin>(corsOrigin => |
||||
|
{ |
||||
|
corsOrigin.ToTable(tablePrefix + "ClientCorsOrigins", schema); |
||||
|
|
||||
|
corsOrigin.HasKey(x => new { x.ClientId, x.Origin }); |
||||
|
|
||||
|
corsOrigin.Property(x => x.Origin).HasMaxLength(ClientCorsOriginConsts.OriginMaxLength).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ClientProperty>(property => |
||||
|
{ |
||||
|
property.ToTable(tablePrefix + "ClientProperties", schema); |
||||
|
|
||||
|
property.HasKey(x => new { x.ClientId, x.Key }); |
||||
|
|
||||
|
property.Property(x => x.Key).HasMaxLength(ClientPropertyConsts.KeyMaxLength).IsRequired(); |
||||
|
property.Property(x => x.Value).HasMaxLength(ClientPropertyConsts.ValueMaxLength).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<PersistedGrant>(grant => |
||||
|
{ |
||||
|
grant.ToTable(tablePrefix + "PersistedGrants", schema); |
||||
|
|
||||
|
grant.Property(x => x.Key).HasMaxLength(PersistedGrantConsts.KeyMaxLength).ValueGeneratedNever(); |
||||
|
grant.Property(x => x.Type).HasMaxLength(PersistedGrantConsts.TypeMaxLength).IsRequired(); |
||||
|
grant.Property(x => x.SubjectId).HasMaxLength(PersistedGrantConsts.SubjectIdMaxLength); |
||||
|
grant.Property(x => x.ClientId).HasMaxLength(PersistedGrantConsts.ClientIdMaxLength).IsRequired(); |
||||
|
grant.Property(x => x.CreationTime).IsRequired(); |
||||
|
grant.Property(x => x.Data).IsRequired(); |
||||
|
|
||||
|
grant.HasKey(x => x.Key); //TODO: What about Id!!!
|
||||
|
|
||||
|
grant.HasIndex(x => new { x.SubjectId, x.ClientId, x.Type }); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<IdentityResource>(identityResource => |
||||
|
{ |
||||
|
identityResource.ToTable(tablePrefix + "IdentityResources", schema); |
||||
|
|
||||
|
identityResource.Property(x => x.Name).HasMaxLength(IdentityResourceConsts.NameMaxLength).IsRequired(); |
||||
|
identityResource.Property(x => x.DisplayName).HasMaxLength(IdentityResourceConsts.DisplayNameMaxLength); |
||||
|
identityResource.Property(x => x.Description).HasMaxLength(IdentityResourceConsts.DescriptionMaxLength); |
||||
|
|
||||
|
identityResource.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.IdentityResourceId).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<IdentityClaim>(claim => |
||||
|
{ |
||||
|
claim.ToTable(tablePrefix + "IdentityClaims", schema); |
||||
|
|
||||
|
claim.HasKey(x => new { x.IdentityResourceId, x.Type }); |
||||
|
|
||||
|
claim.Property(x => x.Type).HasMaxLength(UserClaimConsts.TypeMaxLength).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ApiResource>(apiResource => |
||||
|
{ |
||||
|
apiResource.ToTable(tablePrefix + "ApiResources", schema); |
||||
|
|
||||
|
apiResource.Property(x => x.Name).HasMaxLength(ApiResourceConsts.NameMaxLength).IsRequired(); |
||||
|
apiResource.Property(x => x.DisplayName).HasMaxLength(ApiResourceConsts.DisplayNameMaxLength); |
||||
|
apiResource.Property(x => x.Description).HasMaxLength(ApiResourceConsts.DescriptionMaxLength); |
||||
|
|
||||
|
apiResource.HasMany(x => x.Secrets).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); |
||||
|
apiResource.HasMany(x => x.Scopes).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); |
||||
|
apiResource.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ApiSecret>(apiSecret => |
||||
|
{ |
||||
|
apiSecret.ToTable(tablePrefix + "ApiSecrets", schema); |
||||
|
|
||||
|
apiSecret.HasKey(x => new { x.ApiResourceId, x.Type, x.Value }); |
||||
|
|
||||
|
apiSecret.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired(); |
||||
|
apiSecret.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLength).IsRequired(); |
||||
|
apiSecret.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ApiResourceClaim>(apiClaim => |
||||
|
{ |
||||
|
apiClaim.ToTable(tablePrefix + "ApiClaims", schema); |
||||
|
|
||||
|
apiClaim.HasKey(x => new { x.ApiResourceId, x.Type }); |
||||
|
|
||||
|
apiClaim.Property(x => x.Type).HasMaxLength(UserClaimConsts.TypeMaxLength).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ApiScope>(apiScope => |
||||
|
{ |
||||
|
apiScope.ToTable(tablePrefix + "ApiScopes", schema); |
||||
|
|
||||
|
apiScope.HasKey(x => new { x.ApiResourceId, x.Name }); |
||||
|
|
||||
|
apiScope.Property(x => x.Name).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired(); |
||||
|
apiScope.Property(x => x.DisplayName).HasMaxLength(ApiScopeConsts.DisplayNameMaxLength); |
||||
|
apiScope.Property(x => x.Description).HasMaxLength(ApiScopeConsts.DescriptionMaxLength); |
||||
|
|
||||
|
apiScope.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => new { x.ApiResourceId, x.Name }).IsRequired(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ApiScopeClaim>(apiScopeClaim => |
||||
|
{ |
||||
|
apiScopeClaim.ToTable(tablePrefix + "ApiScopeClaims", schema); |
||||
|
|
||||
|
apiScopeClaim.HasKey(x => new { x.ApiResourceId, x.Name, x.Type }); |
||||
|
|
||||
|
apiScopeClaim.Property(x => x.Type).HasMaxLength(UserClaimConsts.TypeMaxLength).IsRequired(); |
||||
|
apiScopeClaim.Property(x => x.Name).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue