Showing all posts tagged: 'Entity Framework'

A 9-post collection

Query Profiling on Azure SQL

Azure SQL is one of the most valuable Platform as a Service (PaaS) offerings on Azure, second only to Web Apps. It's incredibly cost effective and fully featured. It supports a number of database versions and can be deployed in seconds. The other day I was looking to test something with EF Core and I needed a database to run queries against. I went to the Azure portal, I created a database with prepopulated data using the AdventureWorks (Datawarehouse Workload - DW) and I was ready to connect and run my queries in less than 2 minutes. If you use …[read more]

EF Core migrations with existing database schema and data

I'm currently working on an inherited .NET Core project and I'm loving the experience. I'm still using the project.json project format instead of the newer *.csproj & msbuild one. For now I'll leave it as it is but going forward I'll use the new format for subsequent ASP.NET Core projects. The project also makes use of the newest EF Core so it's all running on the edge of the .NET technology. EF Core Code First is great but the tooling is still rough around the edges. Some things are not there or some of them are not feature …[read more]

Entity Framework Core 1.0 - Table Valued Functions and LINQ Composition

Entity framework Core (EFCore) has been out for a few weeks now after hitting RTM on June 27th 2016. That was also the same day that ASP.NET Core was released. EFCore has brought many changes, to say the least. It was renamed to Core instead the logical continuation from Entity Framework, because it's a total rewrite. Very similar to ASP.NET Core. The rewrite brought many benefits with speed being the biggest one. EF Core is simpler and a lot more powerful, even though it's still early days and some things are not working as expected or are missing. …[read more]

Performance issues with multiple includes and large object graphs - Entity Framework

Entity Framework (EF), Microsoft's ORM answer to nHibernate, is an excellent tool. I've used it many times in many projects. It's easy to get started and set up, it's versatile and has good support. Unfortunately, as with every other tool, there are pitfalls. The larger a project gets, the harder it becomes to use EF straight out-of-the-box. As your objects and relationships grow, your queries need to become more intelligent. More refined. There are many ways to mitigate performance issues, BDD, multiple contexts, query optimization, AutoMapper, etc. I could probably do another post or posts just on this subject! And …[read more]

The specified type member 'Date' is not supported in LINQ to Entities Exception - Entity Framework

EntityFramework is great when it works. You almost don't know it's there, doing its magic in the background while you focus on building your application around your models. However, when it breaks or doesn't work in the way you expect it, you're in for a ride. This morning I spent a bit of time trying to figure out why I was getting the following error on a seemingly straightforward query: The specified type member 'Date' is not supported in LINQ to Entities Exception So, why is this failing? The answer to the question is simple: "LINQ to Entities cannot translate …[read more]