AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

PLINQO support for configurable table owner #456

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
SUMMARY:

Add support for configurable database owner in web.config.  Requirement is 
similar to the DotNetNuke Linq to Sql Model Adapter found at 
http://dnnlinqtosqladapter.codeplex.com/

DETAILS:

Developers typically create their applications using a local database with a 
table owner of "dbo".  They may not know of any special hosting requirements 
until production release (particularly if the application is being sold or 
distributed to third parties).  Unfortunately, some hosting environments do not 
allow users to create tables with the owner of "dbo".  Instead, the host 
requires them to use a custom username as the owner.

Right now, the only workaround is for the developer to change their local 
development database, update their source code and custom-compile a special 
version of their project for that web host.  This leads to multiple copies of 
the source code.  It would be far better if this was configurable in the 
web.config file.

The most common scenario is with custom modules for DotNetNuke.  DNN has 
configuration for a custom object prefix and a custom owner.  LINQ-to-SQL (and 
subsequently PLINQO) does not support this requirement, therefore developers 
cannot create commercially-available DotNetNuke modules using PLINQO.

I ran across an open-source enhancement for the DataContext that is 
specifically designed to resolve this problem for LINQ-to-SQL.  I believe it 
could easily be adapted for use with PLINQO.  Please see here:  
http://dnnlinqtosqladapter.codeplex.com/  

I suspect that the CodeSmith team may be able to address this need with a more 
simple solution since PLINQO controls the code-generation process.  It may be 
possible to make the table name a variable that is determined at runtime 
instead of resorting to dependency injection.

Thanks for your consideration.  I appreciate all the hard work that the 
CodeSmith team has put into PLINQO and I look forward to this and many new 
enhancements.  :-)

Original issue reported on code.google.com by KevinLa...@gmail.com on 21 Jul 2010 at 8:21

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 23 Jul 2010 at 4:41

GoogleCodeExporter commented 9 years ago
The best thing to do is to put your tables in a schema in dev.  That way it can 
be the same on both dev and production.  

As for supporting config options for this, its not really possible for the 
attribute based MappingSource as the attributes are set at compile time.  You 
might be able to use the xml mapping source but that is out of scope of PLINQO. 
You could probably create a quick template to create the xml mapping file.

Original comment by paul.wel...@gmail.com on 29 Jul 2010 at 8:41