Skip to content

Where expression using IEnumerable's contains throws error when using inherited class property #301

@cutig3r

Description

@cutig3r

Consider the following classes
public class Base { public int SomeId { get; set;} }
public class Child: Base { }

Using the following code will fail due to the SomeId property not existing on the child class:
var someIds = new[] { 1, 2, 3};
using (var db = new DbRepository<SqlConnection>(connectionString)) { return db.Query<Child>(c => someIds.Contains(c.SomeId)); }

Metadata

Metadata

Assignees

Labels

requestA request from the community.todoThings to be done in the future

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions