Database connections management


Author
Message
Joseph-Carl Theodat
Joseph-Carl Theodat
StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)
Group: Forum Members
Posts: 29, Visits: 79
Hi,

I read so many posts and it's still not obvious for to me to manage multiple DB connections with BO and Role-Based Security.

Suppose that I have an SF application with Security, what item selected do I need to have in my Database Connection? The SF database?  MyAppDB? A good explanation for the Database Connection for the design phase might help me to fix the problem.

When I select the The SF database, I have an error

SqlException
 Invalid object name 'dbo.SFSPreferences'.

Do I have to manually add

ConnectionManager.AddRequiredDataSourceItem("", "SQL Connection",DataSourceTypeOptions.SqlServer, "MyDatabase", "This connection is used by xxxxx.");     ??

Even at looking the at the Security Sample and reading the Help documentation, I can't figure out the problem... Am I missing something ?

 

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
By default the security assumes that you are going to have the security tables within your applications database.  Obviously you do not have to do this.  You can store the security databases within any database you choose.  You just need to make sure that you application creates a connection to this database.

Using Two Databases

  1. First you need to create a connection pointing to the second database.  You can refer to the help: Application Framework -> Application -> WinForms -> Connection Strings -> ConnectionManagerClass, DataLayer.DataSources Collection

    For Example, in your AppMain.vb file in the SetDataSources() method, I would add a line like this if I were using the Connection String Wizard:

    ConnectionManager.AddRequiredDataSourceItem("SECURITY", "SQL Connection", _
     DataSourceTypeOptions.SqlServer, "YourSecurityDatabase", "The connection to the StrataFrameSample database.")

     
  2. Once you have a connection established to the database which houses the security tables, then you have to tell the framework which DataSourceKey to use.  In the example above, we used SECURITY.  This can be named anything, I just chose SECURITY for this explanation.  Set the SecurityDataSourceKey in the same SetDataSources() method as above.  You can refer to the help documentation: Role-Based Security -> Security within the Application -> Programmatic Access -> Required AppMain.vb (Program.cs) Code -> Setting the SecurityDataSourceKey

    SecurityBasics.SecurityDataSourceKey = "SECURITY"
  3. Now when you run your application, the Role-Based Security BOs will look to the connection with the DataSourceKey of SECURITY instead of the default data source key used by your application.

Joseph-Carl Theodat
Joseph-Carl Theodat
StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)StrataFrame Beginner (39 reputation)
Group: Forum Members
Posts: 29, Visits: 79
Thanks!

So easy when you understand! Wink

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search