views:

12

answers:

1

Greetings -

I could use some with creating a linq to entities statement that would include all my models. I have three models: Alumni, Logs and LogTypes. An Alumnus may have many Logs and Logs may have one LogType. If I want the alumnus with the logs I would say:

Alumnus alumnus = _entities.Alumni.Include("Logs").FirstOrDefault(a = > a.Id = Id);

Works fine, but it does not include the LogType. I thought that .Include("Logs.LogTypes") would do the trick, but it does not. How would I include the LogType? Below is a quick snip of the models:

Alumni
-------
Id
FirstName
LastName

Logs
-------
Id
AlumnusId
LogTypeId
LoggedOn
Detail

LogTypes
---------
Id
Type

Thanks!

+1  A: 

Are you sure that EF didn't singularize LogTypes? What is the name of the property on one of your Log objects? If it is just "LogType", then you need Include("Logs.LogType")

Matt Greer
werks! Thanks man! I knew is was simple; just wasn't seeing it.
gnome