From ada5756c874bec41b19b492e102c31930a09bd5d Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 4 Feb 2016 13:23:42 -0800 Subject: [PATCH] Add more IdentityDbContext ctors --- .../IdentityDbContext.cs | 80 +++++++++++++++---- 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/IdentityDbContext.cs b/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/IdentityDbContext.cs index 74d4f125fb..d6062d24a9 100644 --- a/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/IdentityDbContext.cs +++ b/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/IdentityDbContext.cs @@ -4,21 +4,77 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore { /// /// Base class for the Entity Framework database context used for identity. /// - public class IdentityDbContext : IdentityDbContext { } + public class IdentityDbContext : IdentityDbContext + { + /// + /// Initializes a new instance of . + /// + /// The options to be used by a . + public IdentityDbContext(DbContextOptions options) : base(options) + { } + + /// + /// Initializes a new instance of the class using an . + /// + /// The service provider to be used. + public IdentityDbContext(IServiceProvider serviceProvider) : base(serviceProvider) + { } + + /// + /// Initializes a new instance of the class using an . + /// + /// The options to be used by a . + /// The service provider to be used. + public IdentityDbContext(IServiceProvider serviceProvider, DbContextOptions options) : base(serviceProvider, options) + { } + + /// + /// Initializes a new instance of the class. + /// + public IdentityDbContext() + { } + } /// /// Base class for the Entity Framework database context used for identity. /// /// The type of the user objects. public class IdentityDbContext : IdentityDbContext where TUser : IdentityUser - { } + { + /// + /// Initializes a new instance of . + /// + /// The options to be used by a . + public IdentityDbContext(DbContextOptions options) : base(options) + { } + + /// + /// Initializes a new instance of the class using an . + /// + /// The service provider to be used. + public IdentityDbContext(IServiceProvider serviceProvider) : base(serviceProvider) + { } + + /// + /// Initializes a new instance of the class using an . + /// + /// The options to be used by a . + /// The service provider to be used. + public IdentityDbContext(IServiceProvider serviceProvider, DbContextOptions options) : base(serviceProvider, options) + { } + + /// + /// Initializes a new instance of the class. + /// + public IdentityDbContext() + { } + } /// /// Base class for the Entity Framework database context used for identity. @@ -36,18 +92,14 @@ namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore /// /// The options to be used by a . public IdentityDbContext(DbContextOptions options) : base(options) - { - - } + { } /// /// Initializes a new instance of the class using an . /// /// The service provider to be used. public IdentityDbContext(IServiceProvider serviceProvider) : base(serviceProvider) - { - - } + { } /// /// Initializes a new instance of the class using an . @@ -55,17 +107,13 @@ namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore /// The options to be used by a . /// The service provider to be used. public IdentityDbContext(IServiceProvider serviceProvider, DbContextOptions options) : base(serviceProvider, options) - { - - } + { } /// /// Initializes a new instance of the class. /// - protected IdentityDbContext() - { - - } + public IdentityDbContext() + { } /// /// Gets or sets the of Users.