I have 3 table
public class Request{
[Key]
public int ID { set; get; }
[Required]
[MaxLength(128)]
public string UserId{ set; get; }
[ForeignKey("UserId")]
public virtual AppUser AppUser { get; set; }
}
public class AppUser{
[Key]
public int ID { set; get; }
[Required]
public int GroupID { get; set; }
[ForeignKey("GroupID")]
public virtual Group Group { get; set; }
}
public class Group{
[Key]
public int ID { set; get; }
public string Name { get; set; }
}
I have function GetAll
public IEnumerable<T> GetAll(string[] includes = null)
{
if (includes != null && includes.Count() > 0)
{
var query = dataContext.Set<T>().Include(includes.First());
foreach (var include in includes.Skip(1))
query = query.Include(include);
return query.AsQueryable();
}
return dataContext.Set<T>().AsQueryable();
}
When run function get All
request.GetAll(new string[] {"AppUser"});
the result have object appUser but in AppUser ,Group is null . How i include group in AppUser