Entity with an enum propery type may throw an InvalidCastException when using FromSql #3465
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
EF assumes that columns are returned from the database in the order it expects. This is not always true especially if using FromSql.
Suppose you have a db schema:
calling
db.Pets.FromSql(@"SELECT Id, [Type], [Name] FROM Pet").ToList();
will throw an InvalidCastException. It assumes that the 3rd column is of typePetType
(int).The text was updated successfully, but these errors were encountered: