Purpose: This document describes the process needed to set the data source key that is used to access the StrataFrame security tables.
Setting the SecurityDataSourceKey
The StrataFrame security module requires access to the StrataFrame security tables within some SQL Server database. The SecurityBasics.SecurityDataSourceKey property specifies the key of the DbDataSourceItem that will be used to access the StrataFrame security tables. If the StrataFrame security tables are included within your application's database and the data source key for the database is the default of System.String.Empty (""), then the SecurityBasics.SecurityDataSourceKey does not need to be set because it defaults to an empty string (""). However, if you place the StrataFrame security tables in a database that is outside the application's main database or in a database that is accessed using a different data source key, then the SecurityBasics.SecurityDataSourceKey property must be set to the proper value for the application framework to access the security tables.
The SecurityBasics.SecurityDataSourceKey is generally set anywhere within either the SetDataSources() method or the InitApplication() method, both of which can be found within the AppMain.vb (Program.cs) file. The following sample shows how to set the SecurityDataSourceKey property within the SetDataSources() method.
Imports MicroFour.StrataFrame.Security.BusinessObjects
...
Private Shared Sub SetDataSources()
'-- Set the data sources for the application
DataLayer.DataSources.Add(New SqlDataSourceItem("", "main connstring"))
DataLayer.DataSources.Add(New SqlDataSourceItem("SECURITY", "security connstring"))
'-- Set the SecurityDataSourceKey property to indicate the data source that
' will be used to access the StrataFrame security tables
SecurityBasics.SecurityDataSourceKey = "SECURITY"
End Subusing MicroFour.StrataFrame.Security;
...
private static void SetDataSources()
{
//-- Set the data sources for the application
DataLayer.DataSources.Add(New SqlDataSourceItem("", "main string"));
DataLayer.DataSources.Add(New SqlDataSourceItem("SECURITY", "security string"));
//-- Set the SecurityDataSourceKey property to indicate the data source that
// will be used to access the StrataFrame security tables
SecurityBasics.SecurityDataSourceKey = "SECURITY";
}