In a web application such as wiki or forums or blogging software, it is often useful to store your data in a relational database. Since many hosting companies offer a single database with their hosting plans (with additional additional databases that are optional), this is very useful for your users when your database objects (tables, views, restrictions and stored procedures) have a common prefix. For applications familiar with database shortages, it is typical to have a string encoded table prefix. However, I want more. In particular, I would like to have a table prefix that users can assign in the web.config file (with the corresponding default, of course).
Since I hate coding CRUD operations manually, I prefer to work through a competent OR / M and used (and enjoyed) LINQ to SQL, Subsonic and ADO.Net. I have trash in a new project, however, when it comes to entering the table prefix in the web.config user file. Are there any .NET-based OR / M products that can handle this script elegantly?
So far, the best I've been able to come up with is to use LINQ to SQL with an external mapping file, which I will have to somehow update based on the hypothetical web.config parameter.
Does anyone have a better solution? I tried to do this in the Entity Framework, but it quickly turned into a mess. (Due to my ignorance with EF? Maybe.) How about SubSonic? Is it possible to apply the table prefix in addition to the code generation time?
source share