Mediatr example (#325)
* Updates based on documentation * Getting the build passing * Getting app functioning * A few cleanups to confirm it's working as expected * Fixing functional tests * Updating dockerfile for 3.0 * Functional Tests now run sequentially * Updating to latest version of moq * Adding migration for post 3.0 upgrades * Removing commented out lines * Moving address and catalogitemordered configuration in to classes that own them * Installing MediatR nuget packages * Configure MediatR in Startup * Creating GetMyOrders MediatR query and handler * Adding GetOrderDetails MediatR handler * Refactoring out default values * Added tests for GetOrderDetails mediator handler * Defaulting values on Models for now * Removing some spaces * Splitting files * Splitting out the GetOrderDetails files * Adding test for GetMyOrders * restructuing folders * Using constant
This commit is contained in:
committed by
Steve Smith
parent
1bae9e68d9
commit
29d1497a3f
@@ -1,4 +1,5 @@
|
||||
using Ardalis.ListStartupServices;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@@ -81,7 +82,9 @@ namespace Microsoft.eShopWeb.Web
|
||||
ConfigureCookieSettings(services);
|
||||
|
||||
CreateIdentityIfNotCreated(services);
|
||||
|
||||
|
||||
services.AddMediatR(typeof(BasketViewModelService).Assembly);
|
||||
|
||||
services.AddScoped(typeof(IAsyncRepository<>), typeof(EfRepository<>));
|
||||
services.AddScoped<ICatalogViewModelService, CachedCatalogViewModelService>();
|
||||
services.AddScoped<IBasketService, BasketService>();
|
||||
@@ -109,13 +112,12 @@ namespace Microsoft.eShopWeb.Web
|
||||
options.Conventions.Add(new RouteTokenTransformerConvention(
|
||||
new SlugifyParameterTransformer()));
|
||||
|
||||
});
|
||||
services.AddControllersWithViews();
|
||||
});
|
||||
services.AddRazorPages(options =>
|
||||
{
|
||||
options.Conventions.AuthorizePage("/Basket/Checkout");
|
||||
});
|
||||
|
||||
services.AddControllersWithViews();
|
||||
services.AddControllers();
|
||||
|
||||
services.AddHttpContextAccessor();
|
||||
@@ -207,14 +209,13 @@ namespace Microsoft.eShopWeb.Web
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
app.UseRouting();
|
||||
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseCookiePolicy();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
// Enable middleware to serve generated Swagger as a JSON endpoint.
|
||||
app.UseSwagger();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user