|
|
|
Rank: VistaDB Staff
Groups: Administration, VistaDB Staff
Joined: 8/13/2006 Posts: 3,403 Points: 3,994 Location: Mount Dora, Florida
|
I came across this blog post about a strongly typed include for EF. That has been a sore point for me with Entity Framework. If you have an object (Orders) and you always want to load all the children (OrderDetails) you have to do a really ugly .Include("OrderDetails"  string! What happens if you misspell it? You get a lovely RUNTIME exception. I find it hard to believe MS missed this one. I hope it is fixed in the next EF release. I have not tried the code in the post to see if it works. But it would be nice. Jason Short
|
|
|
|
Rank: Member
Groups: Member
Joined: 10/5/2007 Posts: 12 Points: 27 Location: Beaverton, OR
|
These strings are also a problem during refactoring. I've run into it with another vendors OPF believe it or not. I suppose if I didn't refactor so much it wouldn't be a problem. But I always seem to come up with "better" names as I go so I pretty much dropped it. A refactoring tool is a lot less productive when you still have to run a find in all files command after the refactoring to figure out where all those loose strings you missed are...
-Ron
|
|
|
|
Rank: Team VistaDB
Groups: Member, Team VistaDB
Joined: 8/13/2006 Posts: 528 Points: 2,328 Location: Edinburgh, Scotland
|
|
|
|
|
Rank: VistaDB Staff
Groups: Administration, VistaDB Staff
Joined: 8/13/2006 Posts: 3,403 Points: 3,994 Location: Mount Dora, Florida
|
Yea, why didn't the EF code generator put constants in the namespace. That would let you do an include with .Table.Includes( Othertable.Name ) and it would always be the correct string. I guess you could do it yourself with extension methods. Jason Short
|
|
|
|
Guest
|
YAFPro Theme Created by Jaben Cargman (Tiny Gecko)Powered by YAF 1.9.3 |
YAF © 2003-2009, Yet Another Forum.NETThis page was generated in 0.066 seconds.