-
Notifications
You must be signed in to change notification settings - Fork 53
Closed
Description
public class TestProduct {
// Empty, has shadow key named BrandId
}
public class TestProductDTO {
public int Brand { get; set; }
}
void Test{
var config = new MapperConfiguration(c =>
{
c.CreateMap<TestProduct, TestProductDTO>()
.ForMember(p => p.Brand, c => c.MapFrom(p => EF.Property<int>(p, "BrandId")));
});
config.AssertConfigurationIsValid();
var mapper = config.CreateMapper();
var products = new List<TestProduct>() {
new TestProduct { }
}.AsQueryable();
Expression<Func<TestProductDTO, bool>> expr = x => x.Brand == 2;
var mappedExpression = mapper.MapExpression<Expression<Func<TestProduct, bool>>>(expr);
// The expression above returns: x => EF.Property(p, "BrandId") == 2
}I don't know if this happens for other "functions", apparently the parameter "p" does not get replaced by some visitor during the conversion
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels