React to UsePerRequestServices rename

This commit is contained in:
Hao Kung 2014-10-08 15:51:35 -07:00
parent a4ce31c30d
commit dd58aeedb1
7 changed files with 11 additions and 11 deletions

View File

@ -66,7 +66,7 @@ namespace IdentitySamples
public void Configure(IApplicationBuilder app) public void Configure(IApplicationBuilder app)
{ {
app.UseErrorPage(ErrorPageOptions.ShowAll) app.UseErrorPage(ErrorPageOptions.ShowAll)
.UseServices() .UsePerRequestServices()
.UseStaticFiles() .UseStaticFiles()
.UseIdentity() .UseIdentity()
.UseFacebookAuthentication() .UseFacebookAuthentication()

View File

@ -55,7 +55,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
var context = CreateContext(true); var context = CreateContext(true);
var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()); var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider());
builder.UseServices(services => builder.UsePerRequestServices(services =>
{ {
services.AddEntityFramework().AddSqlServer(); services.AddEntityFramework().AddSqlServer();
services.AddIdentitySqlServer(); services.AddIdentitySqlServer();

View File

@ -112,7 +112,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
EnsureDatabase(); EnsureDatabase();
var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()); var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider());
builder.UseServices(services => builder.UsePerRequestServices(services =>
{ {
services.AddInstance<ILoggerFactory>(new NullLoggerFactory()); services.AddInstance<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer(); services.AddEntityFramework().AddSqlServer();
@ -140,7 +140,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
EnsureDatabase(); EnsureDatabase();
var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()); var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider());
builder.UseServices(services => builder.UsePerRequestServices(services =>
{ {
services.AddInstance<ILoggerFactory>(new NullLoggerFactory()); services.AddInstance<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer(); services.AddEntityFramework().AddSqlServer();

View File

@ -63,7 +63,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
EnsureDatabase(); EnsureDatabase();
var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()); var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider());
builder.UseServices(services => builder.UsePerRequestServices(services =>
{ {
services.AddInstance<ILoggerFactory>(new NullLoggerFactory()); services.AddInstance<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer(); services.AddEntityFramework().AddSqlServer();
@ -91,7 +91,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
EnsureDatabase(); EnsureDatabase();
var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()); var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider());
builder.UseServices(services => builder.UsePerRequestServices(services =>
{ {
services.AddInstance<ILoggerFactory>(new NullLoggerFactory()); services.AddInstance<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer(); services.AddEntityFramework().AddSqlServer();

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Identity.InMemory.Test
response.Setup(r => r.SignIn(It.Is<AuthenticationProperties>(v => v.IsPersistent == isPersistent), It.IsAny<ClaimsIdentity>())).Verifiable(); response.Setup(r => r.SignIn(It.Is<AuthenticationProperties>(v => v.IsPersistent == isPersistent), It.IsAny<ClaimsIdentity>())).Verifiable();
var contextAccessor = new Mock<IContextAccessor<HttpContext>>(); var contextAccessor = new Mock<IContextAccessor<HttpContext>>();
contextAccessor.Setup(a => a.Value).Returns(context.Object); contextAccessor.Setup(a => a.Value).Returns(context.Object);
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
services.AddInstance(contextAccessor.Object); services.AddInstance(contextAccessor.Object);
services.AddIdentity<ApplicationUser, IdentityRole>().AddInMemory(); services.AddIdentity<ApplicationUser, IdentityRole>().AddInMemory();

View File

@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Identity.InMemory.Test
{ {
var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()); var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider());
builder.UseServices(services => services.AddIdentity<ApplicationUser>().AddInMemory()); builder.UsePerRequestServices(services => services.AddIdentity<ApplicationUser>().AddInMemory());
var userStore = builder.ApplicationServices.GetService<IUserStore<ApplicationUser>>(); var userStore = builder.ApplicationServices.GetService<IUserStore<ApplicationUser>>();
var roleStore = builder.ApplicationServices.GetService<IRoleStore<IdentityRole>>(); var roleStore = builder.ApplicationServices.GetService<IRoleStore<IdentityRole>>();
@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Identity.InMemory.Test
public void VerifyUseInMemoryLifetimes() public void VerifyUseInMemoryLifetimes()
{ {
var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()); var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider());
builder.UseServices(services => services.AddIdentity<ApplicationUser>().AddInMemory()); builder.UsePerRequestServices(services => services.AddIdentity<ApplicationUser>().AddInMemory());
var userStore = builder.ApplicationServices.GetService<IUserStore<ApplicationUser>>(); var userStore = builder.ApplicationServices.GetService<IUserStore<ApplicationUser>>();
var roleStore = builder.ApplicationServices.GetService<IRoleStore<IdentityRole>>(); var roleStore = builder.ApplicationServices.GetService<IRoleStore<IdentityRole>>();

View File

@ -114,7 +114,7 @@ namespace Microsoft.AspNet.Identity.Test
public void CanCustomizeIdentityOptions() public void CanCustomizeIdentityOptions()
{ {
var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()); var builder = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider());
builder.UseServices(services => builder.UsePerRequestServices(services =>
{ {
services.AddIdentity<IdentityUser>(); services.AddIdentity<IdentityUser>();
services.AddOptionsAction<PasswordsNegativeLengthSetup>(); services.AddOptionsAction<PasswordsNegativeLengthSetup>();
@ -136,7 +136,7 @@ namespace Microsoft.AspNet.Identity.Test
public void CanSetupIdentityOptions() public void CanSetupIdentityOptions()
{ {
var app = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()); var app = new ApplicationBuilder(new ServiceCollection().BuildServiceProvider());
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
services.AddIdentity<IdentityUser>().ConfigureIdentity(options => options.User.RequireUniqueEmail = true); services.AddIdentity<IdentityUser>().ConfigureIdentity(options => options.User.RequireUniqueEmail = true);
}); });