Browse Source

Revert some of the EF 6.x/EF Core schema changes to avoid issues with migrations

pull/711/head
Kévin Chalet 8 years ago
parent
commit
cdd85c99a6
  1. 9
      src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictApplicationConfiguration.cs
  2. 12
      src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictAuthorizationConfiguration.cs
  3. 9
      src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictScopeConfiguration.cs
  4. 16
      src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictTokenConfiguration.cs

9
src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictApplicationConfiguration.cs

@ -38,15 +38,6 @@ namespace OpenIddict.EntityFrameworkCore
// Entity Framework would throw an exception due to the TKey generic parameter
// being non-nullable when using value types like short, int, long or Guid.
// If primary/foreign keys are strings, limit their length to ensure
// they can be safely used in indexes, specially when the underlying
// provider is known to not restrict the default length (e.g MySQL).
if (typeof(TKey) == typeof(string))
{
builder.Property(application => application.Id)
.HasMaxLength(50);
}
builder.HasKey(application => application.Id);
builder.HasIndex(application => application.ClientId)

12
src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictAuthorizationConfiguration.cs

@ -38,18 +38,6 @@ namespace OpenIddict.EntityFrameworkCore
// Entity Framework would throw an exception due to the TKey generic parameter
// being non-nullable when using value types like short, int, long or Guid.
// If primary/foreign keys are strings, limit their length to ensure
// they can be safely used in indexes, specially when the underlying
// provider is known to not restrict the default length (e.g MySQL).
if (typeof(TKey) == typeof(string))
{
builder.Property(nameof(OpenIddictAuthorization.Application) + nameof(OpenIddictApplication.Id))
.HasMaxLength(50);
builder.Property(application => application.Id)
.HasMaxLength(50);
}
builder.HasKey(authorization => authorization.Id);
builder.HasIndex(

9
src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictScopeConfiguration.cs

@ -34,15 +34,6 @@ namespace OpenIddict.EntityFrameworkCore
// Entity Framework would throw an exception due to the TKey generic parameter
// being non-nullable when using value types like short, int, long or Guid.
// If primary/foreign keys are strings, limit their length to ensure
// they can be safely used in indexes, specially when the underlying
// provider is known to not restrict the default length (e.g MySQL).
if (typeof(TKey) == typeof(string))
{
builder.Property(scope => scope.Id)
.HasMaxLength(50);
}
builder.HasKey(scope => scope.Id);
builder.HasIndex(scope => scope.Name)

16
src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictTokenConfiguration.cs

@ -38,22 +38,6 @@ namespace OpenIddict.EntityFrameworkCore
// Entity Framework would throw an exception due to the TKey generic parameter
// being non-nullable when using value types like short, int, long or Guid.
// If primary/foreign keys are strings, limit their length to ensure
// they can be safely used in indexes, specially when the underlying
// provider is known to not restrict the default length (e.g MySQL).
if (typeof(TKey) == typeof(string))
{
builder.Property(nameof(OpenIddictToken.Application) + nameof(OpenIddictApplication.Id))
.HasMaxLength(50);
builder.Property(nameof(OpenIddictToken.Authorization) + nameof(OpenIddictApplication.Id))
.HasMaxLength(50);
builder.Property(token => token.Id)
.HasMaxLength(50);
}
builder.HasKey(token => token.Id);
builder.HasIndex(token => token.ReferenceId)

Loading…
Cancel
Save