I am using the Microsoft Entity Framework. Consider the following example code:
public class person
{
public int Id { get; set;}
public string Name { get; set;}
public string DisplayName{ get; set;}
public string OtherStuff{get; set;}
}
public MyContext : DbContext
{
public class DbSet<person> persons {get; set;}
}
// In the main...
using(MyContext context = new MyContext)
{
var results = context.persons
.Where(p => p.Name == "someName")
.FirstOrDefault();
}
I would like to do some processing prior to the query actually running based on the arguments to the Where Clause. I would like access to the Property the comparator and the argument if possible.
Essentially, I would like to override the were clause such that I could do some pre-processing and then complete the query and return the results. Is there a mechanism to do this? I would like this to be specific to this specific DBContext and transparent to the caller.
For example, I would like to create a hash of the Name property, and then use it to find the person record in the database.
As another example, I would like to log each name that has been looked up, once this operation is done just return the data.
Thanks