примеры классов:
public class Procedure: SomeBaseClass
{
public Guid Id {get;set;}
public ICollection<Task> Tasks {get;set;}
}
public class Task: SomeBaseClass
{
public Guid Id {get;set;}
public string Name {get;set;}
}
Метод, используемый в выражении colelction:
public viod DoSomethingWithProperties<T>(Guid enittyId, params Expression<Func<TEntity, object>>[] propertiesToDoStuffWith) where T: SomeBaseClass
{
var item = someService<T>().FindById(entityId);
.......
foreach(var expression in propertiesToDoStuffWith)
{
///I need to iterate the propertiesToDetach and determine if the property is a collection so I can perform operations on each item.
}
}
Я могу назвать это так:
DoSomethingWithProperties<Procedure>(1111-1111-1111-1111-1111,p => p.tasks);