4
Imagine the following situation there are 3 classes class A, class B, class C, class A has many classes B and many classes C. class B has many classes C. clsse C has a data datetime field.
public class A
{
DBContext db = new ClassesContext();
public IEnumerable<B> classesB{get; set;}
public IEnumerable<C> classesC{get; set;}
public IEnumerable<C> retornaTodasC()
{
var classes = ....
return classes;
}
}
public class B
{
public IEnumerable<C> classesC{get; set;}
}
public class C
{
public datetime Data;
}
how would a search (done by class A) to the database using LINQ, order by, of all classes C of class A and of classes C of each class B within that class A, sorted by date and storing all classes 3 in a "var classes"?
now imagine that the class A is instantiated sometimes, and use this search a lot, what would be a good solution taking into account the "performance" in this case?