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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -