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

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Mon Dec 27 07:53:36 CST 2010


Hi Gustav --

Sorry, that wasn't copy and paste part of code - original code compiled
well. 

Anyway, I decided to not make it using dynamic approach because this
approach creates additional layer of indirection/dynamics, which I should
better avoid - it's not worth to introduce that indirection/complexity.

Thank you.

--
Shamil
 
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: 27 ??????? 2010 ?. 16:04
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] FW: What is generic way to create ADO.NET EF
objectset?

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