ASP.NET Core TypeScript

I have adapted a style of mirroring C# in TypeScript. I use class instances and interfaces. I also associate scripts with their cshtml counterparts. For type safety I use TypeScript definition files for each JS library I use.

ASP.NET Core memory cache

Response cache is fine for simpler operations, but sometimes you need more fine grained control. System.Runtime.Caching.MemoryCache has builtin support for in-memory cache with expiry.

ASP.NET Core response cache

ASP.NET Core comes with built-in support for response caching. Unlike cache-control header that tells client/proxies how long to cache data, the response cache will cache output of an action.

ASP.NET Core AutoMapper

Mappers solve the problem of copying/translating data from one model to another. I’ve been using AutoMapper for some years and it does the job without too much hassle, and supports a lot of complex scenarios.

ASP.NET Core API with Swagger UI

Swagger makes the API machine readable. This means documentation and client implementations can be produced automatically. Swashbuckle runs top of Swagger and provides an UI. Together they provide nice functionality for documenting and testing your API.

ASP.NET Core API versioning

With API’s often changing over time you may want to plan for versioning early on. ASP.NET Core has a library that makes versioning API a bit easier. By tagging controllers and actions with version number one can run multiple versions simultaneously.

ASP.NET Core MVC with /api/-area

Having MVC pages and API in the same solution can be beneficial. Projects may share a lot of boilerplate code and settings, is easier to maintain and can access API functions directly through DI (if controllers are registered there) instead of going via HTTP. But you may want to separate both URL and code so it is clear what is MVC and what is API.

ASP.NET Core managed config

With .Net Core we finally got some decent/easy to use config system built in by the help of the Options pattern. In short, reading config by deserializing sections of appsettings.json into DI-hosted objects.