MVC4 Linq statement doesn't return all entities
I'm calling a linq statement that doesn't appear to be working correctly:
My Client Model:
public class Client
{
[UIHint("Hidden")]
public int ClientId { get; set; }
[UIHint("Hidden")]
public int UserProfileId { get; set; }
public int Age { get; set; }
[UIHint("Hidden")]
public int GenderId { get; set; }
public string GenderDescription { get; set; }
[UIHint("Hidden")]
public int SettingId { get; set; }
public virtual Gender Gender { get; set; }
public virtual Setting Setting { get; set; }
public virtual UserProfile UserProfile { get; set; }
}
My Linq Call:
var clients = db.Clients.Include(c => c.Gender).Include(c =>
c.Setting).Include(c => c.UserProfile).OrderBy(c => c.ClientId);
This will populate both the Gender and Setting fields with the proper info
based off of the GenderId and SettingId, but the UserProfile does not. Is
there a rational explanation or do I need to keep beating my head against
the desk?
No comments:
Post a Comment