More control over ConnectionManager


Author
Message
Leonard P.
Leonard P.
StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)
Group: Awaiting Activation
Posts: 65, Visits: 306
Hi,

I have a few questions regarding connection manager.

First I need to be able to "purge" all connections stored on user machine in Connections.dat.

This is what I came up with so far:





private static void PurgeConnections()

{

try

{

string connectionDat = Path.Combine(ConnectionManager.ConnectionDataFolder, "Connections.dat");

File.Delete(connectionDat);

}

catch

{ }



}





Does this make sense?, or is there something within SF that I could use? Also my concern is when this code runs on the machine where loged user is not in admin or power user roles. Would this code work?



Second, is there a way to write a new connection string to Connection.bat without calling .SetConnection or .ShowAvailableConnectionsWizard (i.e. without user interaction), my FS application reference other assemblies that manager their own connection strings, and I wont to be able to store them in ConnectionManager.



Thanks

Replies
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
The simple answer is no, ConnectionManager requires user interaction. Once the information is collected, it is placed in an encrypted XML file (connections.dat). You might be able to pull this off...but you don't want to, there is a better way that isn't hard.



For those connections that are not user configurable, just setup the datasources directly, via code:



' In SetDataSources, in AppMain.vb (program.cs)...

Microfour.Strataframe.Data.DataLayer.DataSources.Add(New SqlDataSourceItem("key","Data Source=myserver...")




You'd add a data source for every one you need. Likely, you'd reference the appropriate method in the assembly to get its connection string. The "key" is then set on the BO so it knows were to get the data.



That make sense?



Leonard P.
Leonard P.
StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)StrataFrame Novice (93 reputation)
Group: Awaiting Activation
Posts: 65, Visits: 306
' In SetDataSources, in AppMain.vb (program.cs)...

Microfour.Strataframe.Data.DataLayer.DataSources.Add(New SqlDataSourceItem("key","Data Source=myserver...")






That make sense?







Yes, but from what I've seen (and I could've been doing something wrong) adding new datasource does not persist connection string to the connection store.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Leonard P. - 16 Years Ago
Trent L. Taylor - 16 Years Ago
Leonard P. - 16 Years Ago
Greg McGuffey - 16 Years Ago
Leonard P. - 16 Years Ago
Alex Luyando - 16 Years Ago
Greg McGuffey - 16 Years Ago
Leonard P. - 16 Years Ago
Trent L. Taylor - 16 Years Ago
                         Wow, I didn't know that. That's very cool. :D
Greg McGuffey - 16 Years Ago
                             [quote][b]Greg McGuffey (03/06/2009)[/b][hr]Wow, I didn't know that....
Edhy Rijo - 16 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search