DevTrends BlogThe latest blog articles from devtrends.co.ukuuid:96e0ea59-1487-4926-8398-9e07fa66541f;id=12022-02-01T00:00:00Zhttps://www.devtrends.co.uk/blog/avoid-asnotracking-and-include-when-querying-using-entity-framework-in-asp.netAvoid AsNoTracking and Include when querying using Entity Framework in ASP.NETDevelopers often use AsNoTracking in the belief that it will increase performance when performing read queries in Entity Framework. This post explains why this approach is flawed and its usage may actually be a sign of an underlying problem - a problem that is made even worse by the use of Include.2022-02-01T00:00:00Z2022-02-01T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/annnouncing-configurationextensions-bind-config-to-records-and-classes-with-constructorsAnnouncing ConfigurationExtensions - bind config to C# records and classes with constructorsThis post discusses DevTrends.ConfigurationExtensions, a new NuGet package that extends the built-in .NET configuration functionality to allow config binding to positional C# records and classes with constructors.2022-01-10T00:00:00Z2022-01-10T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/fast-free-geolocation-in-.net-with-freegeoip.netFast Free Geolocation in .NET with freegeoip.netIf you need a simple, server-side way to locate a user based on IP address then you might be interested in the freegeoip.net API. As the name suggests, the service is totally free and has a generous request limit. It is also very easy to use. This post looks at how to call it from .NET.2017-11-15T00:00:00Z2017-11-15T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/3-ways-to-avoid-an-anemic-domain-model-in-ef-core3 Ways To Avoid An Anemic Domain Model In Entity FrameworkAnemic domain models are extremely common when using ORM's such as Entity Framework. This post looks at the problems of having an anemic domain model and then goes on to look at a few simple techniques to allow you to create richer models when using Entity Framework Code First and EF Core.2017-10-12T00:00:00Z2017-10-12T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/installing-the-asp.net-core-2.0-runtime-store-on-linuxInstalling the ASP.NET Core 2.0 runtime store on LinuxThis is a quick post to show how to manually install the ASP.NET runtime store on a production Linux server. Failure to do this will result in your ASP.NET Core 2.0 applications breaking.2017-08-25T00:00:00Z2017-08-25T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/dependency-injection-in-action-filters-in-asp.net-coreDependency Injection in action filters in ASP.NET CoreIt is quite common to decorate ASP.NET MVC controller actions with filter attributes to separate cross cutting concerns from the main concern of the action. Sometimes these filters need to use other components but attributes are quite limited in their functionality and dependency injection into an attribute is not directly possible. This post looks at a few different techniques for injecting dependencies into action filters in ASP.NET Core. We discuss when each method should be used before taking a step back and examining if we can approach the problem in a different way for a cleaner solution.2017-08-22T00:00:00Z2017-08-22T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/custom-response-caching-in-asp.net-core-with-cache-invalidationCustom response caching in ASP.NET Core (with cache invalidation)This post looks at custom output caching and in particular, allowing cache invalidation (cache busting) at the server level to allow the use of response caching for more dynamic pages.2017-08-02T00:00:00Z2017-08-02T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/a-guide-to-caching-in-asp.net-coreA guide to caching in ASP.NET CoreThis post looks at the various techniques available in ASP.NET Core for caching. We'll look at caching of data, partial pages and full pages at the server and client level and explain when to use each2017-07-18T00:00:00Z2017-07-18T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/hashing-encryption-and-random-in-asp.net-coreHashing, Encryption and Random in ASP.NET CoreThis post look at hashing, encryption and random string generation in ASP.NET Core. We examine a few different approaches and explain why some common techniques should be avoided in modern applications.2017-06-27T00:00:00Z2017-06-27T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/create-a-free-private-nuget-server-with-continuous-deployment-using-vstsCreate a Free Private NuGet Server with Continuous Deployment using VSTSIn the last post we looked into shared libraries in .NET Core and concluded that using NuGet packages is the preferred solution for distribution to multiple applications. This post shows how to use Visual Studio Team Services (VSTS) to set up a continuous deployment pipeline for your internal libraries to publish them to a private secure NuGet server.2017-06-16T00:00:00Z2017-06-16T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/creating-your-first-shared-library-in-.net-coreCreating your first shared library in .NET CoreSharing libraries between projects is a fundamental requirement in all but the most simple applications. This post looks at how things have changed with .NET Core. We look at the different types of class library available, how to create a simple library and the best way to reference shared libraries from other applications.2017-06-09T00:00:00Z2017-06-09T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/conditional-middleware-based-on-request-in-asp.net-coreConditional Middleware based on request in ASP.NET CoreThis post looks at how to configure ASP.NET Core middleware in a way that allows you to have different middleware for different types of request. There are many use-cases for this but one common example for this requirement is a project with both MVC and API actions where you want to error handling to be different for each.2017-06-02T00:00:00Z2017-06-02T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/handling-errors-in-asp.net-core-web-apiHandling errors in ASP.NET Core Web APIThis post looks at the best ways to handle exceptions, validation and other invalid requests such as 404s in ASP.NET Core Web API projects and how these approaches differ from MVC error handling.2017-05-25T00:00:00Z2017-05-25T00:00:00ZPaul Hileshttps://www.devtrends.co.uk/blog/handling-404-not-found-in-asp.net-coreHandling 404 Not Found in Asp.Net CoreYou might be surprised to find that the default asp.net core mvc templates do not handle 404 errors gracefully resulting in the standard browser error screen when a page is not found. This posts looks at the various methods for handling 404 not found errors in asp.net core.2017-05-17T00:00:00Z2017-05-17T00:00:00ZPaul Hiles