Archive For August 2018

Accessing The Model From Filters In Razor Pages

calendar_today 29 August 2018 08:23

ASP.NET Core Razor Pages

Support for filters was added to Razor Pages with the release of ASP.NET Core 2.1. Filters, for those unfamiliar with them, are components that enable the injection of processing at certain points within the Razor Page lifecycle. They differ from Middleware in that they provide access to the HttpContext. Razor Pages offers a number of different filter options. One of the things that you might want to do in a filter is to obtain data from an external resource (database, web service etc) and then use it in the PageModel or ViewData. Here, I take a look at how you can access the model or ViewData dictionary depending on the type of filter implementation that you choose.

Query Types in Entity Framework Core

calendar_today 15 August 2018 13:46

Entity Framework ASP.NET Core

Query Types, introduced in Entity Framework Core 2.1 enable you to return non-entity types that map to tables or views and can serve as the return type from FromSql method calls.