I have a method that takes Expression type parameter, in my method i want to get values of this expression but cant find out hot to do that.
private User GetUser(Expression<Func<User, bool>> query)
{
User user = Context.User.Where(query).FirstOrDefault();
return user;
}
I am calling this method with different parameters like
GetUser(u => u.Username == username);
GetUser(u=> u.Email == email);
I want to change GetUser method to work with stored procedures but i need to find what is inside query parameter
I want to check if query is u.Username == username I will call GetUserByUsername SP if query is u.Email == email I will call GetuserByEmail SP