My learning of expression is really basic, I have the following function predicate
Func<RecordViewModel, Func<ReportModel, bool>> exp = rec => x => x.Firstname == rec.Firstname &&
x.Surname == rec.Surname;
var func = exp(new RecordViewModel() { Firstname= "Peter", Surname = "Jones" });
The Following are my model and viewmodel,
public class ReportModel
{
public string Firstname { get; set; }
public string Surname { get; set; }
}
public class RecordViewModel
{
public string Firstname { get; set; }
public string Surname { get; set; }
}
I would like to get the expression serialized to ((ReportModel.Firstname == "Peter") AndAlso (ReportModel.Surname == "Jones")).
Any help of this is greatly appreciated,