Tag Archives: entity framework

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… Read More »

“Unable to load one or more of the requested types.” when using EntityDataSource with Entity Framework in ASP.NET

I always love pushing something out that fails miserably and randomly. Especially when using straight Microsoft technologies. It seems these folks don’t eat their own dog food, or we wouldn’t encounter this crap. Anyway, it took quite a while to figure out the resolution to this issue, but it all lies in the fact that… Read More »

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… Read More »

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.… Read More »

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… Read More »

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… Read More »

EntityDataSource and Relationships, why oh why did you not bring along my relationship?

I spent about 3 hours cursing up a storm over some data binding I was doing using the EntityDataSource against my Entity Framework context. I was feeling lazy and using the declarative data sources to bind against my grid for some automatic operations.  So, should be easy right? Slap on the data source, bind to… Read More »