views:

142

answers:

2

Hello all

I want to give users the possibility to dynamically add new columns at the runtime. I am using the Entity framework v1 ...

I did manage to read as xml and then change ssdl , csdl and msl files and construct new workspace and new object context... But the problem is when i dynamically add new columns in EF model the underlying object is not changed, of course.

How to get the data from model without having concrete entity ? Anonymous type or DBDataRecord would be just fine... Or even some new type created at runtime...

Any idea ?

A: 

Changing the Entity Model CSDL/SSDL will not change the types, because they are used to generate the types at design time. I don't think there is any practical way to modify those types at runtime to reflect your changes to the model.

Dave Swersky
A: 

In v1, you would need to generate a new assembly. This would also require redistributing EdmGen. I don't know if that's legal.

In EF v4, you could probably combine C# dynamic types with code-only modeling and come up with a pretty slick solution to your problem.

Craig Stuntz
Hmmm never crossed my mind that EdmGen distribution is not legal... hope you are not right ;-) EdmGen2.exe has source available and by quickly looking at it's license i would say it is not problem to distribute it..Yes you are right... EF v4 would be great...but i cant use it... :(Anyway i was looking at any solution that i can do through the code without the need for new dll's...
SubGate
Although i did not get answer i was hoping, i will mark this answer as THE answer. i will try to use edmGen2 and will see what will happen. wish me good luck ;)
SubGate