views:

177

answers:

1

Hi.
I have to write a solution that uses different databases with different structure from the same code. So, when a user logs to the application I determine to which database he/she is connected to at runtime. The user can create tables and columns at any time and they have to see the change on the fly. The reason that I use one and the same code the information is manipulates the same way for the different databases. How can I accomplish this at runtime? Actually is the Entity Framework a good solution for my problem?

Thanks in advance.

A: 

You can do this with EF 4 using a code-first model. That said, I tend to avoid changing DB metadata on the fly, with or without EF. Rather, I'd choose a schema which fits the user's changing needs.

Craig Stuntz
Thanks,but it solves only 1 of the problems.So some more details.I'm developing a system that manages different types of employees in a given company.Every company defines their own types.The meta data for every employee type is stored in a table.According to it I create at runtime a separate table for each type and a column for each property.For example Developer with properties age,specialties and Experience.Another type is Sales that has sales count.So,can I create and modify tables with EF at runtime without the need of rebuilding the application?Or I have to use a different technology.
Teddy
My answer still applies to this scenario. Yes, you can change your model at runtime. No, I still don't think your DB changes are a good design. I'd use an EAV schema instead.
Craig Stuntz