Paging in Entity Framework Core

If you’re using Entity Framework Core and building any non-trivial enterprise application then using data tables with paging is almost a certainty. There are two ways to do this: server side and client side. Which one you choose depends on your design and your needs. There are pros and cons associated with both so you need to choose the correct approach for what you want to accomplish. Continue reading “Paging in Entity Framework Core”

Query Filters and Automated Audit Columns

I wanted to write a quick post about using query filters and automatically populating audit columns in Entity Framework Core since I see a lot of people doing this manually still. A common scenario in most applications is to do soft deletes on everything, typically with a column like “IsDeleted”. Another common scenario that is found almost universally in every system are audit columns like “DateCreated” and “DateUpdated”. This is actually very simple to implement, so this is going to be a fairly short post.
Continue reading “Query Filters and Automated Audit Columns”

Maximizing Entity Framework Core Query Performance

Entity Framework Core query performance is something that comes up often when working on projects that rely on it heavily. I have often heard that Entity Framework is not performant enough which then leads to everything being written as a stored procedure. Usually this happens for two main reasons: developers aren’t familiar with how to write queries in a performant manner and developers that are more comfortable with SQL want to develop everything in their technology of choice. Entity Framework is not a silver bullet for everything. There are times when it simply can’t deliver the performance needed or when it is simply functionally incapable of doing what is necessary due to limitations of the framework. That being said, there is no reason you can’t write the vast majority of your application with it and reap all the benefits it provides.
Continue reading “Maximizing Entity Framework Core Query Performance”

IdentityServer4 in ASP.NET Core Part 1

If you’ve worked with APIs at all in .NET Core then you have probably had the need to work with tokens for security. You could roll your own set up just using the underlying functionality in ASP.NET Identity, or you could enable easy mode and use something like IdentityServer4. There are other options out there for you to choose from, but this post will focus on IdentityServer4. Our application is going to consist of an API, a web application for IdentityServer4 and a Javascript based client. The source code for this post can be found here.
Continue reading “IdentityServer4 in ASP.NET Core Part 1”

The Repository Pattern is Dead If You Use Entity Framework

That is, it’s dead if you are using Entity Framework Core. If you’re still using straight ADO.NET, or even just dapper, then the repository pattern still probably makes sense for you. If you’re using Entity Framework, then you really aren’t gaining much from doing so anymore. Five years ago, you could reasonably argue that it was beneficial to use the repository pattern, or some form of abstraction, over entity framework for the following reasons:
Continue reading “The Repository Pattern is Dead If You Use Entity Framework”