>>>>I think its actually supposed to be
>>>>
>>>>public Guid rnh_rtefk { get; set; }
>>>> [ForeignKey("rnh_rtefk")]
>>>>public virtual Route Route { get; set; }
>>>>
>>>>
>>>>The way you have it may not generate any errors, but you might want to verify that the route property is still loading correctly.
>>>
>>>Both ways run without error and both ways return null for Route even though there definitely is a a route with a matching key. :(
>>>
>>>Any idea why that would be?
>>
>>Offhand the only thing I can think of is that you have lazy loading disabled, or your object isn't currently being tracked by the context. Even if lazy loading is enabled, you may want to try explicitly loading the route (see
http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/reading-related-data-with-the-entity-framework-in-an-asp-net-mvc-application). Also, enable the database log and check the output it produces when you try to load the route.
>
>I'm pretty sure I had this working before so I must have changed something when fiddling around with that previous error. I am not seeing anywhere that I am disabling lazy loading. What do you mean by "your object isn't currently being tracked by the context"?
>
>How do I enable the database log?
>
>Thanks for all your help on this!
If your entity is passed in from an external source, created as a new object, or retrieved when change tracking is disabled, it will be in a detached state. Detached entities won't load their navigation properties via lazy loading. If you loaded it from the database using default settings, it should be tracked.
Instructions on the database log can be found here:
http://msdn.microsoft.com/en-us/data/dn469464.aspx