Fixed build break
This commit is contained in:
parent
761a182145
commit
ae379c5dd2
|
|
@ -1,6 +1,7 @@
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Antiforgery;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using MusicStore.Models;
|
||||
|
|
@ -14,7 +15,7 @@ namespace MusicStore.Controllers
|
|||
public MusicStoreContext DbContext { get; set; }
|
||||
|
||||
[FromServices]
|
||||
public AntiForgery AntiForgery { get; set; }
|
||||
public IAntiforgery Antiforgery { get; set; }
|
||||
|
||||
//
|
||||
// GET: /ShoppingCart/
|
||||
|
|
@ -73,7 +74,7 @@ namespace MusicStore.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
AntiForgery.Validate(Context, new AntiForgeryTokenSet(formToken, cookieToken));
|
||||
Antiforgery.ValidateTokens(Context, new AntiforgeryTokenSet(formToken, cookieToken));
|
||||
|
||||
// Retrieve the current user's shopping cart
|
||||
var cart = ShoppingCart.GetCart(DbContext, Context);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
@model MusicStore.ViewModels.ShoppingCartViewModel
|
||||
@inject AntiForgery Xsrf
|
||||
@inject Microsoft.AspNet.Antiforgery.IAntiforgery Xsrf
|
||||
@{
|
||||
ViewBag.Title = "Shopping Cart";
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
{
|
||||
public string GetAntiXsrfToken()
|
||||
{
|
||||
var tokens = Xsrf.GetTokens(Context, null);
|
||||
var tokens = Xsrf.GetTokens(Context);
|
||||
return tokens.CookieToken + ":" + tokens.FormToken;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using Microsoft.AspNet.Http;
|
|||
using Microsoft.AspNet.Http.Features;
|
||||
using Microsoft.AspNet.Http.Internal;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using MusicStore.Controllers;
|
||||
using MusicStore.Models;
|
||||
|
|
@ -22,8 +23,7 @@ namespace MusicStore.Components
|
|||
|
||||
services.AddEntityFramework()
|
||||
.AddInMemoryDatabase()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseInMemoryDatabase());
|
||||
.AddDbContext<MusicStoreContext>(options => options.UseInMemoryDatabase());
|
||||
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Microsoft.AspNet.Http;
|
|||
using Microsoft.AspNet.Http.Features;
|
||||
using Microsoft.AspNet.Http.Internal;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using MusicStore.Models;
|
||||
using Xunit;
|
||||
|
|
@ -24,8 +25,7 @@ namespace MusicStore.Controllers
|
|||
|
||||
services.AddEntityFramework()
|
||||
.AddInMemoryDatabase()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseInMemoryDatabase());
|
||||
.AddDbContext<MusicStoreContext>(options => options.UseInMemoryDatabase());
|
||||
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using MusicStore.Models;
|
||||
using Xunit;
|
||||
|
|
@ -18,8 +19,7 @@ namespace MusicStore.Components
|
|||
var services = new ServiceCollection();
|
||||
services.AddEntityFramework()
|
||||
.AddInMemoryDatabase()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseInMemoryDatabase()););
|
||||
.AddDbContext<MusicStoreContext>(options => options.UseInMemoryDatabase());
|
||||
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ namespace MusicStore.Controllers
|
|||
|
||||
services.AddEntityFramework()
|
||||
.AddInMemoryDatabase()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseInMemoryDatabase()););
|
||||
.AddDbContext<MusicStoreContext>(options => options.UseInMemoryDatabase());
|
||||
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using Microsoft.AspNet.Http.Internal;
|
|||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using MusicStore.Models;
|
||||
using Xunit;
|
||||
|
|
@ -24,8 +25,7 @@ namespace MusicStore.Controllers
|
|||
var services = new ServiceCollection();
|
||||
services.AddEntityFramework()
|
||||
.AddInMemoryDatabase()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseInMemoryDatabase()););
|
||||
.AddDbContext<MusicStoreContext>(options => options.UseInMemoryDatabase());
|
||||
|
||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
.AddEntityFrameworkStores<MusicStoreContext>();
|
||||
|
|
|
|||
|
|
@ -3,16 +3,13 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Antiforgery;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Http.Features;
|
||||
using Microsoft.AspNet.Http.Features.Internal;
|
||||
using Microsoft.AspNet.Http.Internal;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Session;
|
||||
using Microsoft.Framework.Caching.Distributed;
|
||||
using Microsoft.Framework.Caching.Memory;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging.Testing;
|
||||
using MusicStore.Models;
|
||||
using MusicStore.ViewModels;
|
||||
using Xunit;
|
||||
|
|
@ -29,8 +26,7 @@ namespace MusicStore.Controllers
|
|||
|
||||
services.AddEntityFramework()
|
||||
.AddInMemoryDatabase()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseInMemoryDatabase()););
|
||||
.AddDbContext<MusicStoreContext>(options => options.UseInMemoryDatabase());
|
||||
|
||||
services.AddMvc();
|
||||
|
||||
|
|
@ -188,8 +184,8 @@ namespace MusicStore.Controllers
|
|||
|
||||
// AntiForgery initialization
|
||||
serviceProviderFeature.RequestServices = _serviceProvider;
|
||||
var antiForgery = serviceProviderFeature.RequestServices.GetRequiredService<AntiForgery>();
|
||||
var tokens = antiForgery.GetTokens(httpContext, "testToken");
|
||||
var antiForgery = serviceProviderFeature.RequestServices.GetRequiredService<IAntiforgery>();
|
||||
var tokens = antiForgery.GetTokens(httpContext);
|
||||
|
||||
// Header initialization for AntiForgery
|
||||
var headers = new KeyValuePair<string, string[]>(
|
||||
|
|
@ -201,7 +197,7 @@ namespace MusicStore.Controllers
|
|||
var controller = new ShoppingCartController()
|
||||
{
|
||||
DbContext = dbContext,
|
||||
AntiForgery = antiForgery,
|
||||
Antiforgery = antiForgery,
|
||||
};
|
||||
controller.ActionContext.HttpContext = httpContext;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ namespace MusicStore.Controllers
|
|||
|
||||
services.AddEntityFramework()
|
||||
.AddInMemoryDatabase()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseInMemoryDatabase()););
|
||||
.AddDbContext<MusicStoreContext>(options => options.UseInMemoryDatabase());
|
||||
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue