I have a class where some properties are going back to the database, ONLY when they are called. So, let consider the following example:
class User
{
public int UserID { get; internal set; }
public string UserName { get; set; }
public Role[] Roles
{
get
{
if (this.UserID > 0)
return RoleRepository.GetByUserID(this.UserID).ToEntityArray();
else
return RoleRepository.GetByUserName(this.UserName).ToEntityArray();
}
}
}
There is also a Role class, but that's probably not important. The 'Roles' property in the 'User' class is kind of like lazy loading. It is only retrieving the info when that property is accessed. The question is how can I use JQuery to ensure that the lazy loading occurs or is that even possible? Any articles on this concept would also be helpful.
Thanks