I'm passing IList<Post>
to View(posts)
.
Post
is a linqToSql
generated model class.
Post
has an FK
relation to the Category
table by Id
.
When I'm iterating over IList<Post>
inside my View
and trying to access post.Category.Title
I'm receiving an error:
System.ObjectDisposedException: Cannot access a disposed object. Object name: 'DataContext accessed after Dispose.'.
How can I get Category.Title
for each of my Posts
right from View
?