Adding MVC to ASP.NET Core web application

Adding MVC to ASP.NET Core web application

ReviewCoreASPHosting.NET | Best and cheap ASP.NET MVC core hosting. This article refers to an earlier version of the .NET Core SDK and project.json which Microsoft has deprecated in favour of a revamped .csproj file. Now let’s add MVC to the picture. Start off by modifying project.json to require the MVC packages.{ "version": "1.0.0-*", "buildOptions": { "debugType": "portable", "emitEntryPoint": true }, "dependencies": {}, "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" }, "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", "Microsoft.AspNetCore.Mvc": "1.0.0" }, "imports": "dnxcore50" } ...
Read More
Simple Injector ASP.NET Core MVC Integration NuGet package

Simple Injector ASP.NET Core MVC Integration NuGet package

ReviewCoreASPHosting.NET | Best and cheap ASP.NET Core hosting. The following code snippet shows how to use the integration package to apply Simple Injector to your web application’s Startup class.// You'll need to include the following namespaces using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.ViewComponents; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging;using SimpleInjector; using SimpleInjector.Lifestyles; using SimpleInjector.Integration.AspNetCore; using SimpleInjector.Integration.AspNetCore.Mvc;public class Startup { private Container container = new Container();public Startup(IHostingEnvironment env) { // ASP.NET default stuff here }// This method gets called by the runtime. public void ConfigureServices(IServiceCollection services) { // ASP.NET default stuff here services.AddMvc();services.AddSingleton<IControllerActivator>( new SimpleInjectorControllerActivator(container)); services.AddSingleton<IViewComponentActivator>( ...
Read More