ASP.NET Core TypeScript
Part of my ASP.NET Core recipe series: compiling TypeScript as part of the project so the frontend gets types too.
21 articles in the notebook
Part of my ASP.NET Core recipe series: compiling TypeScript as part of the project so the frontend gets types too.
Part of my ASP.NET Core recipe series: using the built-in memory cache for data you don't want to fetch on every request.
Part of my ASP.NET Core recipe series: enabling response caching so identical requests are served without re-executing the pipeline.
Part of my ASP.NET Core recipe series: wiring up AutoMapper to map between entities and view/API models without hand-written copy code.
Part of my ASP.NET Core recipe series: moving EF Core into its own project so the data layer stays separated from the web application.
Part of my ASP.NET Core recipe series: exposing your API with Swagger UI so it documents and exercises itself.
Part of my ASP.NET Core recipe series: adding API versioning so /api/v1/ and /api/v2/ can coexist while clients migrate at their own pace.
Part of my ASP.NET Core recipe series: carving out an /api/-area in an MVC project so pages and API endpoints live cleanly side by side.
Part of my ASP.NET Core recipe series: binding appsettings.json to typed config classes so settings are managed code instead of magic strings.
Part of my ASP.NET Core recipe series: replacing the default logging with Serilog for structured logs with proper sinks.
The opening recipe in my ASP.NET Core series: setting up a clean MVC project as the foundation the rest of the recipes build on.
After ~30 years and a few thousand projects, this is how I set up new .NET solutions: naming, project structure, .NET Standard vs Core choices — and the reasoning behind each habit. Not a book on architecture, just a clean, consistent setup.
Bulk-importing users through Identity Framework 3 kept failing with disposed-object and modified-collection errors. The culprit: async void. Change to async Task and await properly — code included.
Visual Studio 2015 has no GUI support for Areas in ASP.Net 5 yet. The workaround is simple: create the folder structure manually and add an area route in Startup.cs — shown here.
Forgetting to swap config files at deployment can be disastrous. This approach keeps all environment configs in one file, selects the right one automatically, and uses ACLs so developers can't read production secrets.
The default MVC folder layout scatters one feature across Controllers, Views and Scripts. As the project grows, grouping by feature instead keeps related files together — here is how to bend ASP.Net MVC to that layout.
Every ASP.Net app I make emails me its unhandled exceptions — including a MiniDump of the process that you can load into Visual Studio as a paused project and inspect stack, locals and all. Here is the code.
One web.config attribute — optimizeCompilations="true" — makes ASP.Net recompile only what actually changed. Less waiting between test runs; links to the patches needed for older Windows versions.
Using ASP.Net State Server during development forces everything you put in Session to be serializable — which means switching to State Server or SQL sessions in production won't blow up in your face later.
First in a small series on .NET tools worth using: log4net, Apache's free logging framework. One line at the top of each class, a standard XML section in web.config, and you have proper leveled logging.
.NET tools to use, part two: Nini, an uncommonly powerful configuration library. Reads web.config, .ini and .xml config with type conversion and default values in a couple of lines.