T4 Templates for Entity Framework Break when upgrading to Visual Studio 2012

I upgraded to Visual Studio 2012 and consequently upgraded to version 4.5 of the .NET framework. It turns out, this made our T4 templates very unhappy. See, we use T4 templates for generating our Entity Framework(EF) models. A bunch of very fancy template coding that automagically creates our edmx and other code files from a […]

Unit Test to verify Entity Framework Model (EDMX) is accurate

I work extensively with the Entity Framework in most of my projects. One thing that gets frustrating though is when you work with a large team and the data model gets out of synch with your local database. You normally don’t figure it out until you are running some operation in your application and get […]

Using a LINQ compiled query to determine if a record exists with the Entity Framework

I am writing an application that requires high performance on the server layer. The method I am calling will be invoked a large number of times, so I don’t want the overhead of the LINQ compile every time I invoke it. Yes, the compile is very expensive. It is especially so when called a large […]

Entity Framework: The version of SQL Server in use does not support datatype ‘datetime2’

I development against a 2008 copy of SQL Server, which normally isn’t a problem, until….. I pushed out my latest code to the production system, which runs SQL 2005, and started smoke testing the system. As soon as I tried to write a record, i got the data type exception. Its painfully in the innerexception. […]

DataBinding: ‘Telerik.Web.UI.GridInsertionObject’ does not contain a property with the name ‘UserName’.

I use the Telerik controls for a lot of my web work. They save a lot of time but every once in a while they really irritate the hell out of me. A few hours down the rabbit hole and I find that when binding to an EntityDataSource on a RadGrid when trying to insert […]

Entity framework gives you an error when you add foreign key relationships after you already modeled..

The Entity Framework has a lot of nice features in it for mapping relationships. The bugger is its incessant need for the actual foreign key relationships on the database. Unless of course you like editing XML and never want to use the model wizard again. So you model your database without the foreign keys, deciding […]