问题
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