Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DAL+ - extra database connectionDAL+ - extra database connection
Previous
 
Next
New Post
12/11/2006 1:47 AM
 
One idea I've been considering to use in the near future is to store the connect string to the secondary database as part of the "Module Settings" for the module. This would not require you to deal with the Web.config at all. In my mind this has a lot of benefits but you have to see if it would work for you. Michael also has an excellent paper on the utilization of module settings and personalization here: http://www.adefwebserver.com/dotnetnukehelp/Personalization/.

Again, this is my theory at the moment, I have not tried it yet but it should work.

Carlos
 
New Post
12/15/2006 12:03 PM
 

After a few days of fruitless fiddling around, I was unable to do this. I think the DAL+ is best for use in the DotNetNuke install database. I got the web.config set up correctly and I was able to reference the new connection string, but unable to override the default dataprovider

Private Const ProviderType As String = "newData"
Private
_providerConfiguration As Framework.Providers.ProviderConfiguration = Framework.Providers.ProviderConfiguration.GetProviderConfiguration(ProviderType)

I also could not get the dataprovider.Instance() to accept any arguments.

And I don't want to store the connection string in the database either.

 

 
New Post
12/27/2006 11:21 PM
 

If you want DotNetNuke.Data.DataProvider.Instance to accept a parameter you will have to add logic for it to do so

 

In the library (4.4.0) you need to edit Components\Providers\Data\DataProvider.vb

 

Not sure if I exaxtly have it but maybe on the new command it could accdept some string as a parameter of what sql connect string to use

It seems to me you could place some sort of logic in here

#Region "Shared/Static Methods"

  ' singleton reference to the instantiated object
  Private Shared objProvider As DataProvider = Nothing

  ' constructor
  Shared Sub New()
   CreateProvider()
  End Sub

  ' dynamically create provider
  Private Shared Sub CreateProvider()
   objProvider = CType(Framework.Reflection.CreateObject("data"), DataProvider)
  End Sub

  ' return the provider
        Public Shared Shadows Function Instance( MAYBE SOMETHING HERE ) As DataProvider
            Return objProvider Seems I would have to add something to the constructor to handle the string though -
        End Function

#End Region

That would allow us to add in something to select a sql connect string from the web config

 

Anybody with more knowledge got a thought or two here!


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
12/28/2006 11:20 PM
 
Along the lines of my previous post I modified my instance of dnn 4.4.0 to this (same file mentioned before)

 

#Region "Shared/Static Methods"

  ' singleton reference to the instantiated object
        Private Shared objProvider As DataProvider = Nothing

  ' constructor
        Shared Sub New()
            CreateProvider()
        End Sub

        ' dynamically create provider
        Private Shared Sub CreateProvider()
            objProvider = CType(Framework.Reflection.CreateObject("data"), DataProvider)
        End Sub

        ' return the provider
        Public Shared Shadows Function Instance(Optional ByVal DataConnection As String = "data") As DataProvider
            If DataConnection <> "data" Then
                objProvider = CType(Framework.Reflection.CreateObject(DataConnection), DataProvider)
            End If
            Return objProvider
        End Function

#End Region

 

Now it all compiles and everything seems to work so far but not sure if this is the best way to do this

So to use this I would add a connection string to my web.config for my other database

then if I was using the DAL+ methods (should work with the traditional DAL) I would do something like :

   Using dr As IDataReader = DotNetNuke.Data.DataProvider.Instance("newConnectionString").ExecuteReader("Codegalaxy_DNN_Classifieds_Admin_GetAllMainCategories")

then all data from stored proc "Codegalaxy_DNN_Classifieds_Admin_GetAllMainCategories" would come from database defined in the "newConnectionString" connection

- I dont see anything wrong with this small hack.

Can anybody maybe comment on what impact this might have

PS - I know I can use normal data access methods to get to other databases  but using DNNs DAL this makes the whole project cleaner and more easily documented and followed by future developers


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
12/29/2006 11:31 AM
 
okay this doesnt seem to work - I must have had a cached version of the page or something cause it worked once but now it doesnt seem to

Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DAL+ - extra database connectionDAL+ - extra database connection


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out