Database background:
-Parent
|- ChildCollection (with dates)
|- ChildStatus (FK in Child object. ChildStatus is a lookup value)
I use child in the context of the database relation. Inheritance is not a factor here.
What I would like is, in my parent object, to get from the database and store the latest date in the child collection, and the status attached to that child object. The ultimate goal would be to be able to say Parent.LastDate
(as a DateTime
object) and Parent.LastStatus
(as a ChildStatus
object)
I've found a number of posts on how to deal with a calculated field from within the parent, or a count for the number of children, but not a way to actually eagerly load a reference to the grandchild entity without explicitly loading the child collection.
I'd like the two objects available to me if I simply pass Parent
as my model in MVC without including the child entities.
I guess the better question is "how should I be doing this?" Is this a case where I should create a view and populate the additional properties in the view? I haven't worked with views yet, so this may be a simple misunderstanding of the ideal architecture on my part...