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