Question

I'm building a .NET application where a separate database has to be created for each user. Then via UI user can set different settings and depending on that settings database can have different format. The format cannot be predefined as user is able to change table columns, remove some, add new, add new tables.

I wonder what would be the best approach for building Persistence layer of the application. Can Entity Framework or NHibernate be used to support dynamic database structure?

Thanks.

Update

The reason of this requirements is that system has to be able to store records of configurable format. Right now I want to use SQL Server for this and I have an experience with it. Initially I wanted to use MongoDB, but it seems it doesn't suit well for CMS like system where relational links are natural. What about other systems as RavenDB etc.

Was it helpful?

Solution

If you allow user-specified, loosely-defined types in that manner, you are necessarily giving up the advantages of a strongly typed ORM layer. If that's what you have to do then you should give up trying to use an ORM and fall back to ADO.NET style data access with its more flexible datasets and datareaders.

A middle ground would be to serialize those user-defined types as JSON or XML and just parse them when you need them. That way you could still use an ORM for the parts of the app that are strongly typed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top