.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
Post a Comment