зеркало из https://github.com/aspnet/Identity.git
Updating AddEntityFramework call to not use nested closure.
This commit is contained in:
Родитель
990481e48e
Коммит
e9106fdfa9
|
@ -44,9 +44,9 @@ namespace Microsoft.AspNet.Identity.Entity.Test
|
|||
{
|
||||
var services = new ServiceCollection();
|
||||
#if NET45
|
||||
// services.AddEntityFramework(s => s.AddSqlServer());
|
||||
// services.AddEntityFramework().AddSqlServer();
|
||||
//#else
|
||||
services.AddEntityFramework(s => s.AddInMemoryStore());
|
||||
services.AddEntityFramework().AddInMemoryStore();
|
||||
#endif
|
||||
services.AddSingleton<IOptionsAccessor<IdentityOptions>, OptionsAccessor<IdentityOptions>>();
|
||||
services.AddInstance<DbContext>(new IdentityContext());
|
||||
|
@ -63,9 +63,9 @@ namespace Microsoft.AspNet.Identity.Entity.Test
|
|||
{
|
||||
var services = new ServiceCollection();
|
||||
#if NET45
|
||||
// services.AddEntityFramework(s => s.AddSqlServer());
|
||||
// services.AddEntityFramework().AddSqlServer();
|
||||
//#else
|
||||
services.AddEntityFramework(s => s.AddInMemoryStore());
|
||||
services.AddEntityFramework().AddInMemoryStore();
|
||||
#endif
|
||||
// TODO: this needs to construct a new instance of InMemoryStore
|
||||
var store = new InMemoryInMemoryUserStore(new IdentityContext());
|
||||
|
@ -205,7 +205,9 @@ namespace Microsoft.AspNet.Identity.Entity.Test
|
|||
{
|
||||
// TODO: Should be possible to do this without creating the provider externally, but
|
||||
// that is currently not working. Will be investigated.
|
||||
var provider = new ServiceCollection().AddEntityFramework(s => s.AddInMemoryStore()).BuildServiceProvider();
|
||||
var services = new ServiceCollection();
|
||||
services.AddEntityFramework().AddInMemoryStore();
|
||||
var provider = services.BuildServiceProvider();
|
||||
|
||||
using (var db = new IdentityContext(provider))
|
||||
{
|
||||
|
|
|
@ -38,9 +38,9 @@ namespace Microsoft.AspNet.Identity.Entity.Test
|
|||
{
|
||||
var services = new ServiceCollection();
|
||||
#if NET45
|
||||
// services.AddEntityFramework(s => s.AddSqlServer());
|
||||
// services.AddEntityFramework().AddSqlServer();
|
||||
//#else
|
||||
services.AddEntityFramework(s => s.AddInMemoryStore());
|
||||
services.AddEntityFramework().AddInMemoryStore();
|
||||
#endif
|
||||
// TODO: this should construct a new instance of InMemoryStore
|
||||
var store = new EntityRoleStore<EntityRole>(new IdentityContext());
|
||||
|
@ -60,9 +60,9 @@ namespace Microsoft.AspNet.Identity.Entity.Test
|
|||
{
|
||||
var services = new ServiceCollection();
|
||||
#if NET45
|
||||
// services.AddEntityFramework(s => s.AddSqlServer());
|
||||
// services.AddEntityFramework().AddSqlServer())
|
||||
//#else
|
||||
services.AddEntityFramework(s => s.AddInMemoryStore());
|
||||
services.AddEntityFramework().AddInMemoryStore();
|
||||
#endif
|
||||
services.AddTransient<DbContext, IdentityContext>();
|
||||
services.AddTransient<IRoleStore<EntityRole>, EntityRoleStore<EntityRole>>();
|
||||
|
|
|
@ -97,9 +97,9 @@ namespace Microsoft.AspNet.Identity.Entity.Test
|
|||
|
||||
public static IdentitySqlContext CreateContext()
|
||||
{
|
||||
var serviceProvider = new ServiceCollection()
|
||||
.AddEntityFramework(s => s.AddSqlServer())
|
||||
.BuildServiceProvider();
|
||||
var services = new ServiceCollection();
|
||||
services.AddEntityFramework().AddSqlServer();
|
||||
var services.BuildServiceProvider();
|
||||
|
||||
var db = new IdentitySqlContext(serviceProvider);
|
||||
|
||||
|
@ -115,9 +115,9 @@ namespace Microsoft.AspNet.Identity.Entity.Test
|
|||
|
||||
public static ApplicationDbContext CreateAppContext()
|
||||
{
|
||||
var serviceProvider = new ServiceCollection()
|
||||
.AddEntityFramework(s => s.AddSqlServer())
|
||||
.BuildServiceProvider();
|
||||
var services = new ServiceCollection();
|
||||
services.AddEntityFramework().AddSqlServer();
|
||||
var serviceProvider = services.BuildServiceProvider();
|
||||
|
||||
var db = new ApplicationDbContext(serviceProvider);
|
||||
|
||||
|
|
|
@ -35,13 +35,14 @@ namespace Microsoft.AspNet.Identity.Entity.Test
|
|||
{
|
||||
public static IdentityContext CreateContext()
|
||||
{
|
||||
var serviceProvider = new ServiceCollection()
|
||||
var services = new ServiceCollection();
|
||||
|
||||
//#if NET45
|
||||
// .AddEntityFramework(s => s.AddSqlServer())
|
||||
// services.AddEntityFramework().AddSqlServer();
|
||||
//#else
|
||||
.AddEntityFramework(s => s.AddInMemoryStore())
|
||||
services.AddEntityFramework().AddInMemoryStore();
|
||||
//#endif
|
||||
.BuildServiceProvider();
|
||||
var serviceProvider = services.BuildServiceProvider();
|
||||
|
||||
var db = new IdentityContext(serviceProvider);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче