Lets say I have two L2S classes generated by the designer with one property as follows:
public class A
{
public bool IsActive {get;set;}
}
public class B
{
public bool IsActive {get;set;}
}
I have a generic DataAccess class as follows:
public class DataAccessBase<T> where T : class
{
NWDataContext dataContext = new NWDataContext();
public IList<T> GetAllActive()
{
return dataContext.GetTable<T>()
.where(T.IsActive == true) -----> How can i do something like this?
.ToList<T>();
}
}
Now from the GetAllActive() how can I return all active objects of either A or B type. My guess is that I have to use reflection to do this but I am very new to reflection. Can anyone point me in the right direction?