I just started using LINQ a couple of days ago and i'm stuck now.
Given a certain type i need to recurse to the top. For example:
hierarchy: Client, Project, Department.
proposed function descriptor to load hierarchy:
public static IEnumerable<object> LoadPath<T>(int id) where T : class, ContentItem, new()
{
}
the user specifies T is department with id being he id of a department. the datacontext holds the tables and relationships of the hierarchy.
The problem here is that Client, Project and Department is just an example. It could be anything. It's all dynamically created using an XmlMappingSource based on some other tables in the db. It also holds the information to know which fields are in those classes. Those classes in turn also exist and are known by the DataContext.
for example: dbo.Client maps to MyProject.BL.Client and so on. But for the sake of argument let's assume all classes have a field 'Name'.
But how do i dynamically create a collection that holds the names of Department, Project & Client?
Thanks, Jay