Tuesday, 25 November 2008

Entity Framework, how could you? :(

Yeah, that's it. Entity Framework has shocked me in the morning. I tried to wrap some legacy code with nice EF function and everything seemed to work fine - model browser showed me stored procedure and it's ObjectContext analogue. But the trick is that it existed only in EF XML mapping, not in C# code =(. After some googling I've found something very frustrating:

Function import code will not be generated if stored procedure it's mapping returns scalar value.

I'm upset :( All is left is to wrap result value with some fake entity. Perhaps, I could have written my own function but it's not the case for framework-that-does-everything-for-you.

Hope this feature (bug! bug!) will be fixed in EF v2.