Last active
May 5, 2020 12:30
-
-
Save enisn/464ec2df57ae0bca93aca760d8c12d88 to your computer and use it in GitHub Desktop.
Challenge #1 - Expression - Manual
This file contains 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
// x => | |
var parameter = Expression.Parameter(typeof(Product), "x"); | |
// x => x.Code | |
var property = Expression.Property(parameter, "Code"); | |
// x.Code == filter.Code | |
var comparison = Expression.Equal(property, Expression.Constant(filter.Code)); | |
var lambda = Expression.Lambda<Func<Product, bool>>(comparison, parameter); | |
var query = db.Products.Where(comparison); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment