Browse Source

Reorder OpenIddictContext's generic arguments to allow specifying a custom TRole entity easily

pull/131/head
Kévin Chalet 10 years ago
parent
commit
a384f6e5a8
  1. 49
      src/OpenIddict.EntityFramework/OpenIddictContext.cs

49
src/OpenIddict.EntityFramework/OpenIddictContext.cs

@ -29,11 +29,10 @@ namespace OpenIddict {
/// Represents an OpenIddict-powered Entity Framework context. /// Represents an OpenIddict-powered Entity Framework context.
/// </summary> /// </summary>
/// <typeparam name="TUser">The type of the User entity.</typeparam> /// <typeparam name="TUser">The type of the User entity.</typeparam>
public class OpenIddictContext<TUser> : OpenIddictContext<TUser, OpenIddictApplication, public class OpenIddictContext<TUser> : OpenIddictContext<TUser, IdentityRole, OpenIddictApplication,
OpenIddictAuthorization, OpenIddictAuthorization,
OpenIddictScope, OpenIddictScope,
OpenIddictToken, OpenIddictToken, string>
IdentityRole, string>
where TUser : OpenIddictUser { where TUser : OpenIddictUser {
/// <summary> /// <summary>
/// Initializes a new OpenIddict context without configuring the Entity Framework options. /// Initializes a new OpenIddict context without configuring the Entity Framework options.
@ -52,11 +51,10 @@ namespace OpenIddict {
/// </summary> /// </summary>
/// <typeparam name="TUser">The type of the User entity.</typeparam> /// <typeparam name="TUser">The type of the User entity.</typeparam>
/// <typeparam name="TKey">The type of the primary key used by the Identity/OpenIddict entities.</typeparam> /// <typeparam name="TKey">The type of the primary key used by the Identity/OpenIddict entities.</typeparam>
public class OpenIddictContext<TUser, TKey> : OpenIddictContext<TUser, OpenIddictApplication<TKey>, public class OpenIddictContext<TUser, TKey> : OpenIddictContext<TUser, IdentityRole<TKey>, OpenIddictApplication<TKey>,
OpenIddictAuthorization<TKey>, OpenIddictAuthorization<TKey>,
OpenIddictScope<TKey>, OpenIddictScope<TKey>,
OpenIddictToken<TKey>, OpenIddictToken<TKey>, TKey>
IdentityRole<TKey>, TKey>
where TUser : OpenIddictUser<TKey> where TUser : OpenIddictUser<TKey>
where TKey : IEquatable<TKey> { where TKey : IEquatable<TKey> {
/// <summary> /// <summary>
@ -75,19 +73,44 @@ namespace OpenIddict {
/// Represents an OpenIddict-powered Entity Framework context. /// Represents an OpenIddict-powered Entity Framework context.
/// </summary> /// </summary>
/// <typeparam name="TUser">The type of the User entity.</typeparam> /// <typeparam name="TUser">The type of the User entity.</typeparam>
/// <typeparam name="TRole">The type of the Role entity.</typeparam>
/// <typeparam name="TKey">The type of the primary key used by the Identity/OpenIddict entities.</typeparam>
public class OpenIddictContext<TUser, TRole, TKey> : OpenIddictContext<TUser, TRole, OpenIddictApplication<TKey>,
OpenIddictAuthorization<TKey>,
OpenIddictScope<TKey>,
OpenIddictToken<TKey>, TKey>
where TUser : OpenIddictUser<TKey>
where TRole : IdentityRole<TKey>
where TKey : IEquatable<TKey> {
/// <summary>
/// Initializes a new OpenIddict context without configuring the Entity Framework options.
/// </summary>
protected OpenIddictContext() { }
/// <summary>
/// Initializes a new OpenIddict context.
/// </summary>
/// <param name="options">The options used to configure the Entity Framework context.</param>
public OpenIddictContext(DbContextOptions options) : base(options) { }
}
/// <summary>
/// Represents an OpenIddict-powered Entity Framework context.
/// </summary>
/// <typeparam name="TUser">The type of the User entity.</typeparam>
/// <typeparam name="TRole">The type of the Role entity.</typeparam>
/// <typeparam name="TApplication">The type of the Application entity.</typeparam> /// <typeparam name="TApplication">The type of the Application entity.</typeparam>
/// <typeparam name="TAuthorization">The type of the Authorization entity.</typeparam> /// <typeparam name="TAuthorization">The type of the Authorization entity.</typeparam>
/// <typeparam name="TScope">The type of the Scope entity.</typeparam> /// <typeparam name="TScope">The type of the Scope entity.</typeparam>
/// <typeparam name="TToken">The type of the Token entity.</typeparam> /// <typeparam name="TToken">The type of the Token entity.</typeparam>
/// <typeparam name="TRole">The type of the Role entity.</typeparam>
/// <typeparam name="TKey">The type of the primary key used by the Identity/OpenIddict entities.</typeparam> /// <typeparam name="TKey">The type of the primary key used by the Identity/OpenIddict entities.</typeparam>
public class OpenIddictContext<TUser, TApplication, TAuthorization, TScope, TToken, TRole, TKey> : IdentityDbContext<TUser, TRole, TKey> public class OpenIddictContext<TUser, TRole, TApplication, TAuthorization, TScope, TToken, TKey> : IdentityDbContext<TUser, TRole, TKey>
where TUser : OpenIddictUser<TKey, TAuthorization, TToken> where TUser : OpenIddictUser<TKey, TAuthorization, TToken>
where TRole : IdentityRole<TKey>
where TApplication : OpenIddictApplication<TKey> where TApplication : OpenIddictApplication<TKey>
where TAuthorization : OpenIddictAuthorization<TKey, TToken> where TAuthorization : OpenIddictAuthorization<TKey, TToken>
where TScope : OpenIddictScope<TKey> where TScope : OpenIddictScope<TKey>
where TToken : OpenIddictToken<TKey> where TToken : OpenIddictToken<TKey>
where TRole : IdentityRole<TKey>
where TKey : IEquatable<TKey> { where TKey : IEquatable<TKey> {
/// <summary> /// <summary>
/// Initializes a new OpenIddict context without configuring the Entity Framework options. /// Initializes a new OpenIddict context without configuring the Entity Framework options.

Loading…
Cancel
Save