War
War

Reputation: 8618

WCF DataServices and dynamically changing datasets

from what i've seen so far WCF Data Services are pretty easy to setup when using then in combination with EF.

That's kinda what i'm after out of the box but I also need the ability for the EF model to change at runtime.

I'm building an app where the app users will be able to specify the database structure and then begin populating it ... the relevant UI components needed are then generated with MVC using some clever rule based trickery.

So for example the user will be given a "Create new Object" button, which will let them specify field names.

Once that part is complete the user submits that and it generates a new table in the db. From there the UI components are generated that allow that table to be managed within the app.

The problem of course is getting that new table in to the EF model without a recompile of the back end data service.

The concept being that this builds the database and the pages required to manage the various parts of it (there's a bigger picture in mind here but i don't want to confuse matters by trying to explain it all).

I'm thinking that maybe EF is not the right tool to use at the moment .. because it needs a strongly typed set of entities in order to work ... that may not be possible in this case.

I'm toying with the idea of passing this service Dynamic objects ... (e.g. objects of type Something : dynamic )

Upvotes: 0

Views: 907

Answers (3)

War
War

Reputation: 8618

OMG ...

Apparently this is supported (mostly) out the box with EF 4.2

http://blogs.msdn.com/b/adonet/archive/2011/09/28/ef-4-2-release-candidate-available.aspx

WOW !!!

Upvotes: 0

J. Tihon
J. Tihon

Reputation: 4459

WCF Data Services can be used without Entity Framework. Using either the "Reflection Provider" or a custom provider, which you will have to implement (the Reflection provider requires you to have actual .NET classes, which you don't).

Basically, you implement the DataService class and the IServiceProvider interface, which will provide instances of the IDataServiceQueryProvider, IDataServiceMetadataProvider and IDataServiceUpdateProvider. This might involve a lot of work, so be sure that you actually do want to do this.

See http://msdn.microsoft.com/en-us/library/ee960143.aspx for more information.

Upvotes: 1

Dave Rael
Dave Rael

Reputation: 1759

i'd suggest not only that entity framework is not right for this, but neither is a relational database. document database or key-value store would probably be a better fit than trying to create tables on demand to shove this into a relational structure.

Upvotes: 1

Related Questions