.net - specified cast from a materialized 'System.String' type to the 'CityType' type is not valid. - enum support in entity framework -


i have class:

class citydetails {    id int,    //other attributes    citytype type; } 

i using ef. trying data view , populate in list of citytype. citytype class has property name "type" of type citytype enum. view in sql server has column same name "type" , has values correspond enum element names. following code giving me error:

list<citydetails> l = dbcontext.database.sqlquery<citydetails>(view_query).tolist(); 

error:

the specified cast materialized 'system.string' type 'domain.models.views.citytype' type not valid.

enum support has been available since ef 5.0. using ef 6 alpha 2.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -