c# - MVC4 Migrations from existing project -
i'm working on existing visual studio mvc 4 application migrations , trying rebuild/have run locally. have running exception of following error:
system.invalidcastexception: unable cast object of type 'system.data.entity.dynamicproxies.queuemember_f9e4ddd7fda5c... type mvc4test.domain.entities.catergoryqueuemember"
so thought importing migrations folder suffice-- didn't fix i'm getting same error.
so question: there way 'clean' migrations in new solution don't keep getting invalid cast exception??
the method triggering error:
public actionresult index() { ienumerable<catergoryqueue> queues = unitofwork.categoryqueuerepository.get(orderby: o => o.orderby(q => q.name), includeproperties:"queuemembers"); ilist<userqueuemodel> models = new list<userqueuemodel>(); foreach(catergoryqueue queue in queues) { catergoryqueuemember member = (catergoryqueuemember)queue.queuemembers.singleordefault(m=>m.useraccountid == websecurity.currentuserid); if(member != null) { userqueuemodel model = mapper.map<catergoryqueue,userqueuemodel>(queue); model.currentuseropt = (currentmember.optout==null ? false: (bool)member.optout); models.add(model) } } return view(models); }