Modules Custom Connection String

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
8/28/2010 7:57:58 PM
Gravatar
Total Posts 70

Modules Custom Connection String

Hi Joe !!!

For scalability reasons, I will need to create some of my custom modules on a exclusive database (other than mojoportals one). I just loved your "auto setup"  for installing and upgrading database objects so I'll do a little "something" to allow configuring an alternate connection string for a module.

From what I could figure, a simple "CustomConnectionString" field in FeatureDeffinition, stored on mp_modules table would do the trick. After that, you could add a little logic in setup/default.aspx.cs to read this connection string using "applicationId".

Using this connection String as the last parameter of DatabaseHelper.RunScript  will do the trick since you already have an OverrideConnectionInfo logic.

If you agree with the changes, I could make them and send to you for validation. If that's not an option, please let me know ... I'll do a little fork on default.aspx.cs and read the OverrideConnectionString from a Module Setting in mp_modulesettings using ApplicationId.

 

*Edit*

Maybe a CustomConnectionStringKey that points to a user.config key would be more flexible.

8/29/2010 9:02:50 AM
Gravatar
Total Posts 18439

Re: Modules Custom Connection String

Hi Bruno,

It is interesting that you ask this because I've come upon a need to do the same thing. I implemented simple convention based solution this morning, and created a document about how to use it here:

http://www.mojoportal.com/using-a-different-database-for-a-feature.aspx

The FeatureDefinition file is really not related to the running of database scripts at all, it will run scripts that exist on disk in correct locations even when there is no featuredefinition file. The feature definition file is really just used to install the control for the feature and configure default settings. The list of supported databases in the featuredefinition is only used to decide whether to install the control or not.

The convention based approach I think is better than storing connection strings in the database and was easier to implement.

Best,

Joe

9/10/2010 9:52:23 PM
Gravatar
Total Posts 70

Re: Modules Custom Connection String

Thanks Joe !!! I'll have a look at it 

You must sign in to post in the forums. This thread is closed to new posts.