Browse Source

Use new modelBuilder.IsUsingMySQL method.

pull/4135/head
Halil İbrahim Kalkan 6 years ago
parent
commit
5b17e18cdf
  1. 18
      modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs
  2. 4
      modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerModelBuilderConfigurationOptions.cs

18
modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs

@ -78,7 +78,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
b.HasKey(x => new { x.ClientId, x.RedirectUri });
if (options.DatabaseProvider == EfCoreDatabaseProvider.MySql)
if (IsMySql(builder, options))
{
b.Property(x => x.RedirectUri).HasMaxLength(300).IsRequired();
}
@ -96,7 +96,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
b.HasKey(x => new { x.ClientId, x.PostLogoutRedirectUri });
if (options.DatabaseProvider == EfCoreDatabaseProvider.MySql)
if (IsMySql(builder, options))
{
b.Property(x => x.PostLogoutRedirectUri).HasMaxLength(300).IsRequired();
}
@ -127,7 +127,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
b.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired();
if (options.DatabaseProvider == EfCoreDatabaseProvider.MySql)
if (IsMySql(builder, options))
{
b.Property(x => x.Value).HasMaxLength(300).IsRequired();
}
@ -197,7 +197,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
b.Property(x => x.ClientId).HasMaxLength(PersistedGrantConsts.ClientIdMaxLength).IsRequired();
b.Property(x => x.CreationTime).IsRequired();
if (options.DatabaseProvider == EfCoreDatabaseProvider.MySql)
if (IsMySql(builder, options))
{
b.Property(x => x.Data).HasMaxLength(10000).IsRequired();
}
@ -268,7 +268,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
b.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired();
b.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength);
if (options.DatabaseProvider == EfCoreDatabaseProvider.MySql)
if (IsMySql(builder, options))
{
b.Property(x => x.Value).HasMaxLength(300).IsRequired();
}
@ -334,5 +334,13 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
b.HasIndex(x => x.Expiration);
});
}
private static bool IsMySql(
ModelBuilder modelBuilder,
IdentityServerModelBuilderConfigurationOptions options)
{
return options.DatabaseProvider == EfCoreDatabaseProvider.MySql ||
modelBuilder.IsUsingMySQL();
}
}
}

4
modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerModelBuilderConfigurationOptions.cs

@ -1,4 +1,5 @@
using JetBrains.Annotations;
using System;
using JetBrains.Annotations;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
@ -6,6 +7,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
{
public class IdentityServerModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions
{
[Obsolete("No need to manually set database provider after v2.9+. If it doesn't set automatically, use modelBuilder.UseXXX() in the OnModelCreating method of your DbContext (XXX is your database provider name).")]
public EfCoreDatabaseProvider? DatabaseProvider { get; set; }
public IdentityServerModelBuilderConfigurationOptions(

Loading…
Cancel
Save