string propertyName = "FirstName";
string value = "Steven";
var type = typeof(Employee);
var param = Expression.Parameter(type,"e");
var propertyRef = Expression.Property(param,propertyName);
var constantRef = Expression.Constant(value);
var expr = Expression.Lambda<Func<Employee, bool>>(Expression.Equal(propertyRef, constantRef), new[] { param});
var propertyRef1 = Expression.Property(param,"LastName");
var constantRef1 = Expression.Constant("Buchanan");
var rightExp = Expression.Lambda<Func<Employee, bool>>(Expression.Equal(propertyRef1, constantRef1), new[] { param });
var exprCombined = Expression.Lambda<Func<Employee, bool>>(Expression.And(expr.Body, rightExp.Body), new[] { param});
var employees = session.Query<Employee>().Where(exprCombined); // Query 1
var employees2 = session.Query<Employee>().Where(t=>t.FirstName=="Steven"&&t.LastName=="Buchanan").Dump(); //Query 2
Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
string propertyName = "FirstName";
string value = "Steven";
var type = typeof(Employee);
var param = Expression.Parameter(type,"e");
var propertyRef = Expression.Property(param,propertyName);
var constantRef = Expression.Constant(value);
var expr = Expression.Equal(propertyRef, constantRef);
var propertyRef1 = Expression.Property(param,"LastName");
var constantRef1 = Expression.Constant("Buchanan");
var rightExp =Expression.Equal(propertyRef1, constantRef1);
var exprCombined = Expression.Lambda<Func<Employee, bool>>(Expression.And(expr, rightExp), new[] { param});
var employees = session.Query<Employee>().Where(exprCombined);
Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
--
e => ((e.FirstName == "Steven") AndAlso (e.LastName == "Buchanan"))
Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
--