Last active
April 16, 2020 19:35
-
-
Save enisn/1017213b6b76fac49f211206c985bc62 to your computer and use it in GitHub Desktop.
Challenge #1 - Solution 1 - Range And - Manual
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parameter = Expression.Parameter(typeof(Product), "x"); | |
var property = Expression.Property(parameter, "Stock"); | |
var comparisonGt = Expression.GreaterThan(property, Expression.Constant(0)); | |
var comparisonLt = Expression.LessThan(property, Expression.Constant(9)); | |
var comparison = Expression.And(comparisonGt, comparisonLt); | |
var lambda = Expression.Lambda<Func<Product,bool>>(comparison, parameter); | |
var query = db.Products.Where(lambda); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment