How can we get DynamicData working with EFPocoAdapter?

微笑、不失礼 提交于 2019-12-14 02:03:46

问题


My team is hoping to use the EFPocoAdapter, but are also hoping to use the DynamicData tools with it but are having some issues.

We basically added a "Dynamic Data Entities Web Application" project to the EFPocoAdapter Northwind sample solution (I am using the latest version, 1.03), referenced the needed assemblies and then uncommented and edited the line in the Global.asax.cs file that registers a context with the MetaModel to look like this:

model.RegisterContext(typeof(NorthwindEF.NorthwindEntities), 
      new ContextConfiguration() { ScaffoldAllTables = true });

We get this error: "The context type 'NorthwindEF.NorthwindEntities' is not supported."

The question we have is, how can we make this a valid context or how else can we hack things to make this work for us?

Any pointers are appreciated, thanks.


回答1:


You need to add the DynamicData.EFCodeFirstProvider, available from Nuget, just search for EFCodeFirstProvider. Then you use:

DefaultModel.RegisterContext(
            new EFCodeFirstDataModelProvider(() => new NorthwindEF.NorthwindEntities()),
            new ContextConfiguration() { ScaffoldAllTables = true });


来源:https://stackoverflow.com/questions/440943/how-can-we-get-dynamicdata-working-with-efpocoadapter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!