ASP.NET Core 2.0 - Repository Overview: Action Results

In This Series ASP.NET Core MVC - Repository Overview: Model Binding ASP.NET MVC Core - Repository Overview: Value Providers ASP.NET Core 2.0 - Repository Overview: Action Discovery ASP.NET Core 2.0 - Repository Overview: Action Selection ASP.NET Core 2.0 - Repository Overview: Razor Pages ASP.NET Core 2.0 - Repository Overview: Action Results Contents Introduction What is the View Result Returning a view result Executing a view result The Executor Finding and Compiling your View View Location Expanders View Locator Cache Generating an IRazorView Cache Invalidation Rendering the Razor Page Creating a Custom Action Result Summary Introduction This series tries to explain the underlying mechanisms of ASP....

October 8, 2017 · 7 min · 1432 words · Jack Histon

2 Simple Ways To Improve Your Unit Tests

Over the past 20 years, testing has become a cornerstone of software development. To turn software development into a true profession, we need to create robust, secure, safe, and efficient systems. The simplest tool in our toolbox starts us on this road: the unit test. Like an accountant, the unit test is a fantastic way for us to perform double-entry bookkeeping. The unit test double checks our work is correct, and makes sure we keep it from morphing into something we did not want....

October 3, 2017 · 4 min · 825 words · Jack Histon

ASP.NET Core 2.0 - Repository Overview: Razor Pages

Previously in this Series ASP.NET Core MVC - Repository Overview: Model Binding ASP.NET MVC Core - Repository Overview: Value Providers ASP.NET Core 2.0 - Repository Overview: Action Discovery ASP.NET Core 2.0 - Repository Overview: Action Selection Contents Introduction What is Razor Pages? How to setup Razor Pages Creating your first Razor Page The RazorProjectPageRouteModelProvider Class Razor Pages and Forms The code-behind file The Razor Page Application Model Dealing with Multiple Handlers Getting rid of the handler query parameter Summary Introduction This article is the fifth in a series I’m dedicating to reviewing the code and design of the ASP....

September 24, 2017 · 15 min · 3187 words · Jack Histon

ASP.NET Core 2.0 - Repository Overview: Action Selection

Previously in this Series ASP.NET Core MVC - Repository Overview: Model Binding ASP.NET MVC Core - Repository Overview: Value Providers ASP.NET Core 2.0 - Repository Overview: Action Discovery Contents Introduction The ActionSelector Class Dependencies The Route Value Cache Conventional Routing A Note on Cache Efficiency Attribute Routing Attribute Routing with Route Templates Selecting the Best Candidate Evaluating the Constraints Summary Introduction This article is the fourth in a series I’m dedicating to reviewing the code and design of the ASP....

September 9, 2017 · 8 min · 1625 words · Jack Histon

ASP.NET Core 2.0 - Repository Overview: Action Discovery

Previously in this Series ASP.NET Core MVC - Repository Overview: Model Binding ASP.NET MVC Core - Repository Overview: Value Providers Contents Introduction Registering Actions Finding Controller Actions The Controller Feature Provider The Default Application Model Provider Customising Controller Action Discovery Finding Razor Pages The Razor Project PageRouteModel Provider The Compiled PageRouteModel Provider Razor Pages Route Template Summary Introduction This article is the third in a series I’m dedicating to reviewing the code and design of the ASP....

September 2, 2017 · 8 min · 1588 words · Jack Histon

ASP.NET MVC Core – Repository Overview: Value Providers

Value providers are part of the model binding ecosystem, and so if you want a more general overview, please see the first post within this series. Contents Introduction What is a value provider? How it all works MvcOptions Value Provider Factories The Controller Context The Composite Value Provider Binding Sources Why? Creating your own Value Provider Summary Introduction This is the second installment of blog posts that I will be sharing over the coming weeks that discuss the ASP....

August 25, 2017 · 9 min · 1893 words · Jack Histon

ASP.NET MVC Core – Repository Overview: Model Binding

I think that the best way to learn how to code, is to read code. That is why I think the number one tool out there for an aspiring developer is GitHub. When I found out that the ASP.NET Core team at Microsoft were going to open source their platforms, I was ecstatic. Not just because of the open source movement, but because it would be my chance to learn the techniques used at Microsoft, and how they provide such a wonderful framework to work in....

August 21, 2017 · 6 min · 1072 words · Jack Histon

Sharing Controller and Views in ASP.NET Core

This post will describe how to share controllers and views across ASP.NET Core applications, shared via an ASP.NET Core library. Best practices within the model-view-controller (MVC) world dictate that we should keep our controllers as thin as possible. Controllers should be extracted away from business logic, operational logic, and any sort of decision making. The only real thing controllers should be doing, are acting as a bridge. A bridge from the http world, to the domain logic of an application....

August 15, 2017 · 2 min · 387 words · Jack Histon

The Interface Segregation Principle

Why is the single responsibility principle (SRP) so hard to define? From my experience, SRP stumbles people much more than any other SOLID principle. I thought back to my own struggles with the five principles, and thought it would be better to explain SOLID in a different way; or rather, a different order. What is an interface? a point where two systems, subjects, organizations, etc. meet and interact. When A wants to interact with B, A will communicate through interface C, for which A and B mutually understands....

August 3, 2017 · 5 min · 1003 words · Jack Histon