Browse Source

Rename OpenIddictContext to OpenIddictDbContext

pull/142/head
XperiAndri 10 years ago
committed by Kévin Chalet
parent
commit
fd7420c445
  1. 6
      README.md
  2. 2
      samples/Mvc.Server/Models/ApplicationDbContext.cs
  3. 48
      src/OpenIddict.EntityFramework/OpenIddictDbContext.cs

6
README.md

@ -102,17 +102,17 @@ public void Configure(IApplicationBuilder app) {
public class ApplicationUser : OpenIddictUser { } public class ApplicationUser : OpenIddictUser { }
``` ```
- **Update your Entity Framework context to inherit from `OpenIddictContext`**: - **Update your Entity Framework context to inherit from `OpenIddictDbContext`**:
```csharp ```csharp
public class ApplicationDbContext : OpenIddictContext<ApplicationUser> { public class ApplicationDbContext : OpenIddictDbContext<ApplicationUser> {
public ApplicationDbContext(DbContextOptions options) public ApplicationDbContext(DbContextOptions options)
: base(options) { : base(options) {
} }
} }
``` ```
> **Note:** although recommended, inheriting from `OpenIddictContext` is not mandatory. Alternatively, you can also create your own context and manually add the entity sets needed by OpenIddict: > **Note:** although recommended, inheriting from `OpenIddictDbContext` is not mandatory. Alternatively, you can also create your own context and manually add the entity sets needed by OpenIddict:
```csharp ```csharp
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public class ApplicationDbContext : IdentityDbContext<ApplicationUser> {

2
samples/Mvc.Server/Models/ApplicationDbContext.cs

@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore;
using OpenIddict; using OpenIddict;
namespace Mvc.Server.Models { namespace Mvc.Server.Models {
public class ApplicationDbContext : OpenIddictContext<ApplicationUser, IdentityRole<Guid>, Guid> { public class ApplicationDbContext : OpenIddictDbContext<ApplicationUser, IdentityRole<Guid>, Guid> {
public ApplicationDbContext(DbContextOptions options) public ApplicationDbContext(DbContextOptions options)
: base(options) { } : base(options) { }

48
src/OpenIddict.EntityFramework/OpenIddictContext.cs → src/OpenIddict.EntityFramework/OpenIddictDbContext.cs

@ -12,38 +12,38 @@ namespace OpenIddict {
/// <summary> /// <summary>
/// Represents an OpenIddict-powered Entity Framework context. /// Represents an OpenIddict-powered Entity Framework context.
/// </summary> /// </summary>
public class OpenIddictContext : OpenIddictContext<OpenIddictUser> { public class OpenIddictDbContext : OpenIddictDbContext<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.
/// </summary> /// </summary>
protected OpenIddictContext() { } protected OpenIddictDbContext() { }
/// <summary> /// <summary>
/// Initializes a new OpenIddict context. /// Initializes a new OpenIddict context.
/// </summary> /// </summary>
/// <param name="options">The options used to configure the Entity Framework context.</param> /// <param name="options">The options used to configure the Entity Framework context.</param>
public OpenIddictContext(DbContextOptions options) : base(options) { } public OpenIddictDbContext(DbContextOptions options) : base(options) { }
} }
/// <summary> /// <summary>
/// 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, IdentityRole, OpenIddictApplication, public class OpenIddictDbContext<TUser> : OpenIddictDbContext<TUser, IdentityRole, OpenIddictApplication,
OpenIddictAuthorization, OpenIddictAuthorization,
OpenIddictScope, OpenIddictScope,
OpenIddictToken, string> OpenIddictToken, 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.
/// </summary> /// </summary>
protected OpenIddictContext() { } protected OpenIddictDbContext() { }
/// <summary> /// <summary>
/// Initializes a new OpenIddict context. /// Initializes a new OpenIddict context.
/// </summary> /// </summary>
/// <param name="options">The options used to configure the Entity Framework context.</param> /// <param name="options">The options used to configure the Entity Framework context.</param>
public OpenIddictContext(DbContextOptions options) : base(options) { } public OpenIddictDbContext(DbContextOptions options) : base(options) { }
} }
/// <summary> /// <summary>
@ -51,22 +51,22 @@ 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="TRole">The type of the Role entity.</typeparam> /// <typeparam name="TRole">The type of the Role entity.</typeparam>
public class OpenIddictContext<TUser, TRole> : OpenIddictContext<TUser, TRole, OpenIddictApplication, public class OpenIddictDbContext<TUser, TRole> : OpenIddictDbContext<TUser, TRole, OpenIddictApplication,
OpenIddictAuthorization, OpenIddictAuthorization,
OpenIddictScope, OpenIddictScope,
OpenIddictToken, string> OpenIddictToken, string>
where TUser : OpenIddictUser where TUser : OpenIddictUser
where TRole : IdentityRole { where TRole : IdentityRole {
/// <summary> /// <summary>
/// Initializes a new OpenIddict context without configuring the Entity Framework options. /// Initializes a new OpenIddict context without configuring the Entity Framework options.
/// </summary> /// </summary>
protected OpenIddictContext() { } protected OpenIddictDbContext() { }
/// <summary> /// <summary>
/// Initializes a new OpenIddict context. /// Initializes a new OpenIddict context.
/// </summary> /// </summary>
/// <param name="options">The options used to configure the Entity Framework context.</param> /// <param name="options">The options used to configure the Entity Framework context.</param>
public OpenIddictContext(DbContextOptions options) : base(options) { } public OpenIddictDbContext(DbContextOptions options) : base(options) { }
} }
/// <summary> /// <summary>
@ -75,23 +75,23 @@ namespace OpenIddict {
/// <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="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, TRole, TKey> : OpenIddictContext<TUser, TRole, OpenIddictApplication<TKey>, public class OpenIddictDbContext<TUser, TRole, TKey> : OpenIddictDbContext<TUser, TRole, OpenIddictApplication<TKey>,
OpenIddictAuthorization<TKey>, OpenIddictAuthorization<TKey>,
OpenIddictScope<TKey>, OpenIddictScope<TKey>,
OpenIddictToken<TKey>, TKey> OpenIddictToken<TKey>, TKey>
where TUser : OpenIddictUser<TKey> where TUser : OpenIddictUser<TKey>
where TRole : IdentityRole<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.
/// </summary> /// </summary>
protected OpenIddictContext() { } protected OpenIddictDbContext() { }
/// <summary> /// <summary>
/// Initializes a new OpenIddict context. /// Initializes a new OpenIddict context.
/// </summary> /// </summary>
/// <param name="options">The options used to configure the Entity Framework context.</param> /// <param name="options">The options used to configure the Entity Framework context.</param>
public OpenIddictContext(DbContextOptions options) : base(options) { } public OpenIddictDbContext(DbContextOptions options) : base(options) { }
} }
/// <summary> /// <summary>
@ -104,7 +104,7 @@ namespace OpenIddict {
/// <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="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, TRole, TApplication, TAuthorization, TScope, TToken, TKey> : IdentityDbContext<TUser, TRole, TKey> public class OpenIddictDbContext<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 TRole : IdentityRole<TKey>
where TApplication : OpenIddictApplication<TKey, TToken> where TApplication : OpenIddictApplication<TKey, TToken>
@ -115,13 +115,13 @@ namespace OpenIddict {
/// <summary> /// <summary>
/// Initializes a new OpenIddict context without configuring the Entity Framework options. /// Initializes a new OpenIddict context without configuring the Entity Framework options.
/// </summary> /// </summary>
protected OpenIddictContext() { } protected OpenIddictDbContext() { }
/// <summary> /// <summary>
/// Initializes a new OpenIddict context. /// Initializes a new OpenIddict context.
/// </summary> /// </summary>
/// <param name="options">The options used to configure the Entity Framework context.</param> /// <param name="options">The options used to configure the Entity Framework context.</param>
public OpenIddictContext(DbContextOptions options) : base(options) { } public OpenIddictDbContext(DbContextOptions options) : base(options) { }
/// <summary> /// <summary>
/// Gets or sets the database set containing the applications. /// Gets or sets the database set containing the applications.
Loading…
Cancel
Save