I set an object entity with a stored procedure, but the navigation properties are always equa开发者_StackOverflowls at null ...
The aim is to include or join an external entity.
Any idea ?
Thanks
You have to "load" your navigation properties before accessing them. If the navigation is a collection, use
yourNavigationPropertyName.Load();
if it's a single object, use the reference property associated :
yourNavigationPropertyNameReference.Load();
Later in your development, you should meet an usual related problem. I suggest you to take a look on this post, which deals with entity framework lazy loading :
ADO.NET Entity Framework IsLoaded and Load
It's a single object, I will use the reference property associated, thanks. My issue is all foreign keys (navigation properties) are null when I set the object entity with the stored procedure, so I can't make a "load". I don't know why ...
My Code :
var sp = context.GetUserEntityTransactions(SesameId);
List transations = new List(sp.ToList());
The transations foreign keys are null
精彩评论