How can we get DynamicData to work with the EFPocoAdapter?

My team hopes to use the EFPocoAdapter, but also hopes to use the DynamicData tools with it, but there are some problems.

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

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

We get this error: "Context type" NorthwindEF.NorthwindEntities "is not supported."

The question 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.

+2
source share
1 answer

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

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

Source: https://habr.com/ru/post/1437766/


All Articles