Configuring ASP.NET Core Application Settings

Configuring ASP.NET Core Application Settings

ReviewCoreASPHosting.NET | Best and cheap ASP.NET Core 2.0 hosting. With all of the controversy around project configurations within .NET Core, one thing that has managed to be consistently JSON-based has been the use of application settings configuration files in this new world. While JSON does read incredibly easily, it can very quickly become muddled if you are storing large, complex objects consisting of nested objects and arrays, each with multiple properties of different types, and so on. Thankfully, you have options. And I don't mean options like going to use XML; I mean that there's a specific framework designed to tackle issues like these and make working with these potentially cumbersome configurations much more manageable. Enter the Options Framework The Options framework is a very basic framework that is specifically designed to handle accessing and configuring POCO settings within .NET Core, and it simply couldn't be easier to work with. Now let's say that you have a configuration file for your application that looks...
Read More
Create a versioned and documented ASP.NET Core Web API

Create a versioned and documented ASP.NET Core Web API

ReviewCoreASPHosting.NET | Best and cheap ASP.NET Core 1.0 hosting. Let’s create a versioned and semi-automatically documented Web API, this could be done both for public API, and quite useful for, internal-use API’s as well. The ASP.NET Core Web API Project Create a new project Visual C# > .NET Core > ASP.NET Core Web Application and give a descriptive name to your API. We’re going to add three NuGet packages: Install-Package Microsoft.AspNetCore.Mvc.Versioning Install-Package Swashbuckle.AspNetCore -Pre Install-Package SwashbuckleAspNetVersioningShim -Pre Two of these packages are prerelease packages but they are fully functional You can now remove the automatically created ValuesController.cs and let’s add a new HelloController.cs using Microsoft.AspNetCore.Mvc; namespace VersionedWebApi.Controllers { /// <summary> /// HelloController, just saying Hello World! /// </summary> [ApiVersion("1.0", Deprecated = true)] [Route("api/v{version:apiVersion}/[controller]")] public class HelloController : Controller { /// <summary> /// Default Get call returning Hello World! ...
Read More