2

as I understand it when using WPF with the MVVM pattern, on the Model side of things, you can have your classes and entity data classes(which act as a type of database access).

I have run my eye over a few tutorials that have used a 'ADO.NET Entity Data Model' in VS2010 to produce the classes for the entities. Table and column definitions are hard-coded.

My question is, in part of my application users will be able create their own tables, in this case can the entity model still work? Up until now it seems a little inflexible. My system tables will very rarely change, however user tables will. How and can it handle being dynamic?

1
  • Only option I'm aware of is to have a look at dynamic data projects Commented May 22, 2013 at 12:38

2 Answers 2

4

Entity Framework is a "static" ORM - you have to declare your tables and columns in code before compilation. So yes, the limitation you mention is likely to be problematic in a situation where your database schema is changing rapidly.

It may help you to look at an alternative ORM that makes use of more dynamic code generation. Many of the .NET Micro-ORMs support this. I've not had much experience with them, but I believe that both Massive and Simple.Data support this kind of thing.

Note that this will have a prerequisite of .NET 4 or above, as dynamic wasn't supported in 3.5.

Sign up to request clarification or add additional context in comments.

Comments

0

If you are saying that your users can create tables (entities) on the fly, that doesn't really mix well with EF, or quite frankly any data access strategy that populates classes. The problem is you are essentially creating new "classes" at run time via your user created tables. This would be better suited for data sets/tables, or datareaders.

2 Comments

Not strictly true - this is exactly the stuff that dynamic typing helps most with. EF is definitely not going to be of help though :-)
I had not looked at Massive before. Good find +1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.