c# - EntityFramework tries to CAST enum to number -
i using entityframework 6.1.3 oracle , have enum below:
public enum terms { notspecified, i, ii, iii, iv }
i have entity uses enum:
public class report { public short year { get; set; } public terms termid { get; set; } }
when try filter according termid generated query casts termid number(10, 0):
terms termid = terms.i; iqueryable<report> query = ....; query = query.where(m => m.termid == termid);
generated query tries cast term , slow:
where (( cast( "extent1"."term" number(10,0))) = :p_ling_0);
when remove cast
lightning fast. tried setting hascolumntype
, changing type of enum short, byte , following scenarios without success:
.where(m => (int)m.termid == (int)termid); // casting still there .where(m => m.termid.equals(termid)); // equals not supported enums .where(m => ((int)termid).equals((int)m.termid)); // casting still there
how can prevent ef generating query cast
?
Comments
Post a Comment