I am trying to populate my WebGrid from LINQ to SQL.
It has the following columns:
Username
Email
First Name
Last Name
IsApproved
IsLockedOut
IsOnline
LastActivityDate
LastLoginDate
CreationDate
All of this comes from the User object:
dbc.Users
However everything except First Name and Last Name is an association from aspnet_Membership and aspnet_User which is defined in my LINQ to SQL. How do I set these as the proper column names?
I tried:
var accounts = dbc.Users.Select(User => new User
{
Username => aspnet_Membership.username
}).ToList();
For username but it is not working.
How would I do this?
It would be:
No => for property assignment, but assuming that’s not the case and what you need is to “flatten” the resultset between multiple objects, one way to work around having one entity with multiple tables is to manage this by using an anonymous class:
Or, define a view, and add this to your model. This is another way to have a common entity.