[dba-VB] FW: What is generic way to create ADO.NET EF object set?

Gustav Brock gustav at cactus.dk
Mon Dec 27 07:04:00 CST 2010


Hi Shamil

Shouldn't it just read:

  string entityName = "Supplier";

/gustav

>>> shamil at smsconsulting.spb.ru 27-12-2010 10:40 >>>
Hi All -

That code works:

ObjectContext entities = new Northwind.NET.Model.NorthwindNETEntities();
var dataSet = entities.CreateObjectSet<Model.Supplier>();

And I wanted to have something like that:

string enitytName = "NorthwindNETEntities.Supplier"; ...
ObjectContext entities = new Northwind.NET.Model.NorthwindNETEntities();
var dataSet = entities.CreateObjectSet<EntityObject>(entityName);

IOW to supply entity name as a string variable, but the above code currently
returns the following error message:

System.InvalidOperationException : Mapping and metadata information could
not be found for EntityType 'System.Data.Objects.DataClasses.EntityObject'.

Googling didn't give any prompt clues here...

Thank you.

--
Shamil






More information about the dba-VB mailing list