Convert DBContext to ObjectContext for use with GridView

前端 未结 3 1134
甜味超标
甜味超标 2020-11-30 04:49

I have a webforms project using EF codefirst to persist data. I\'d like to use a GridView and EntityDataSource, in order to save writing CRUD. Is this possible?

Can

3条回答
  •  日久生厌
    2020-11-30 05:26

    After 2 days of struggling , I found this link which helped me a lot.I am working withVS 2012 and I had same problem with DBContext.
    According to the link, in VS2012 the default code generator was changed to generate POCO entities and DBContext as opposed to entities derived from EntityObject and ObjectContext which was default in VS2010.
    In solution explorer, under your entity model, You need to remove tt templates and, in the designer, righ-click on the designer surface and then in the properties change the code generation strategy from None to Default to get EntityObject based entities and ObjectContext derived context.

提交回复
热议问题