ASP.NET MVC - Can't access a parent class in a database relationship (LINQ TO SQL)
Posted
by Alex
on Stack Overflow
See other posts from Stack Overflow
or by Alex
Published on 2010-05-29T21:06:24Z
Indexed on
2010/05/29
21:12 UTC
Read the original article
Hit count: 148
asp.net-mvc
|linq-to-sql
I have a class User and a class History. History has 'User' property, and User has 'Histories' property. So there's a database relationship.
But when I create a new User history class and set UserID property, I can't access the 'User' property.
var history = new History { UserID = 1 };
// history.User = null ???
How can I get the user?
© Stack Overflow or respective owner