The Entity Framework is a fantastic tool that reduces development time on new projects. While it used to take a significant amount of time to write a data access layer, the Entity Framework now handles much of this for you. There are many good reasons to use the Entity Framework, but it requires some care to use properly; poor use can result in substantial performance degradation. I’ve been able to distil the majority of what a developer needs to know about EF performance down to three concepts.
A useful extension method that c# .NET provides is Distinct(). Sometimes you need to get distinct objects by a property of those objects, however, and there is no overload of Distinct() that accepts a lambda expression. Luckily, it’s easy enough to create our own.
Every web application requires data validation to ensure that the data remains correct and useful. If you’re working with ASP.NET MVC, the good news is that the framework greatly simplifies this task. In this article, I’ll go over how to handle data validation when using the database first approach.
There are several great articles online on how to add data validation to an MVC project(including one over at the official ASP.NET site), but in general they all focus on the code first approach, which differs from the database first approach.