I have following class to override list methods:
public class As400Set<T> : List<T>
{
public As400Set<T> Where(Expression<Func<T, bool>> expression)
{
//do something
}
public T SingleOrDefault(Expression<Func<T, bool>> expression)
{
//do something
}
}
Everything works. So far so good. Now I want to extend the query with a select:
var item= context.Persons.Where(w => w.FirstName == "Hans").Select(s => s.LastName);
How can I override and the select method now? Is it even possible to query both methods one after the other?
What am I trying to achieve with my As400Set?
I am currently developing my own little OR mapper for our IBM system and would like to use it like EF. The where extension, for example, indicates the expression and query the database.
I also override for example the add method to set a changetracker state
public new void Add(T entity)
{
// do something
base.Add(entity);
}
That's why I've derived from List so far