jeudi 11 juin 2015

How to fetch all records from the DbSet using Dynamic Proxy?

I'm rather new to the DynamicProxy world, so I need some well advices.

For the test aims, I create the entities like this:

dynamic instance = Activator.CreateInstance(entityType, new object[] { connectionString }); 

The instance has been created successfully:

enter image description here

If to cast some dynamic properties of instance and itself to some strictly typed variables, so there is no problem too:

enter image description here

But the problem begins when I try to fetch the result from the dynamic proxy. I'm rather confused how to fetch it...

Because Linq methods can't be done with the casted DbSet object like:

.Select(value => value).ToList();

enter image description here

So, what am I doing wrong and how to fetch all records from the Context obtained by the dynamic proxy?





Aucun commentaire:

Enregistrer un commentaire