Skip to content

Commit

Permalink
🔀 Merge pull request #11 from kritikos-io/develop
Browse files Browse the repository at this point in the history
Fixes nonsense warnings and corrects CI
  • Loading branch information
akritikos authored Apr 7, 2021
2 parents 279f45d + 04aa42c commit 1c571d4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ protected ApiAuthorizationDbContext(
#region Overrides of IdentityDbContext<TUser,TRole,TKey,IdentityUserClaim<TKey>,IdentityUserRole<TKey>,IdentityUserLogin<TKey>,IdentityRoleClaim<TKey>,IdentityUserToken<TKey>>

/// <inheritdoc cref="DbContext"/>
protected override void OnModelCreating(ModelBuilder modelBuilder)
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(modelBuilder);
base.OnModelCreating(builder);
var configurationStoreOptions = this.GetService<IOptions<ConfigurationStoreOptions>>()?.Value
?? throw new InvalidOperationException(nameof(ConfigurationStoreOptions));
var operationalStoreOptions = this.GetService<IOptions<OperationalStoreOptions>>()?.Value
?? throw new InvalidOperationException(nameof(OperationalStoreOptions));

modelBuilder.ConfigurePersistedGrantContext(operationalStoreOptions);
modelBuilder.ConfigureResourcesContext(configurationStoreOptions);
modelBuilder.ConfigureClientContext(configurationStoreOptions);
builder.ConfigurePersistedGrantContext(operationalStoreOptions);
builder.ConfigureResourcesContext(configurationStoreOptions);
builder.ConfigureClientContext(configurationStoreOptions);
}

#endregion Overrides of IdentityDbContext<TUser,TRole,TKey,IdentityUserClaim<TKey>,IdentityUserRole<TKey>,IdentityUserLogin<TKey>,IdentityRoleClaim<TKey>,IdentityUserToken<TKey>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,24 @@ protected ApiAuthorizationPooledDbContext(
/// exposed in <see cref="T:Microsoft.EntityFrameworkCore.DbSet`1" /> properties on your derived context. The resulting model may be cached
/// and re-used for subsequent instances of your derived context.
/// </summary>
/// /// <param name="modelBuilder">The builder being used to construct the model for this context. Databases (and other extensions) typically
/// /// <param name="builder">The builder being used to construct the model for this context. Databases (and other extensions) typically
/// define extension methods on this object that allow you to configure aspects of the model that are specific
/// to a given database.</param>
/// <remarks>
/// /// If a model is explicitly set on the options for this context (via <see cref="M:Microsoft.EntityFrameworkCore.DbContextOptionsBuilder.UseModel(Microsoft.EntityFrameworkCore.Metadata.IModel)" />)
/// then this method will not be run.
/// </remarks>
protected override void OnModelCreating(ModelBuilder modelBuilder)
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(modelBuilder);
base.OnModelCreating(builder);
var configurationStoreOptions = this.GetService<IOptions<ConfigurationStoreOptions>>()?.Value
?? throw new InvalidOperationException(nameof(ConfigurationStoreOptions));
var operationalStoreOptions = this.GetService<IOptions<OperationalStoreOptions>>()?.Value
?? throw new InvalidOperationException(nameof(OperationalStoreOptions));

modelBuilder.ConfigurePersistedGrantContext(operationalStoreOptions);
modelBuilder.ConfigureResourcesContext(configurationStoreOptions);
modelBuilder.ConfigureClientContext(configurationStoreOptions);
builder.ConfigurePersistedGrantContext(operationalStoreOptions);
builder.ConfigureResourcesContext(configurationStoreOptions);
builder.ConfigureClientContext(configurationStoreOptions);
}

#endregion Overrides of IdentityDbContext<TUser,TRole,TKey,IdentityUserClaim<TKey>,IdentityUserRole<TKey>,IdentityUserLogin<TKey>,IdentityRoleClaim<TKey>,IdentityUserToken<TKey>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,11 @@ namespace Kritikos.Configuration.Persistence.Converters
public class EnumToDescriptionStringConverter<TEnum> : ValueConverter<TEnum, string>
where TEnum : struct, Enum
{
private static readonly Dictionary<TEnum, string> EnumString;

static EnumToDescriptionStringConverter()
{
var values = Enum.GetValues(typeof(TEnum)).Cast<TEnum>();

EnumString = values?.ToDictionary(
x => x,
GetDescription)
?? new Dictionary<TEnum, string>();
}
private static readonly Dictionary<TEnum, string> EnumString = Enum.GetValues(typeof(TEnum))
.Cast<TEnum>()
.ToDictionary(
x => x,
GetDescription);

public EnumToDescriptionStringConverter(ConverterMappingHints? mappingHints = null)
: base(
Expand Down

0 comments on commit 1c571d4

Please sign in to comment.