The Ed-Fi Dashboards can be configured to connect to databases in different ways. Two illustrative connection string approaches are shown below.
Approach 1: One Connection String per Local Education Agency
The default configuration is one Local Education Agency per database. The as-shipped configuration sample data is set up to connect to the Glendale ISD datastore.
<connectionStrings>
<!-- NOTE: Add new connection string placeholders for deployment in Web.connectionStrings.config -->
<clear />
<add name="Application_Db" connectionString="Database=EdFi_Application; Data Source=(local); Persist Security Info=True; User Id=edfiPService; Password=edfiPService;" providerName="System.Data.SqlClient" />
<!-- Depending on the setup that you require we support various types of DB separation.-->
<add name="GlendaleISD" connectionString="Database=EdFi_Dashboard; Data Source=(local); Persist Security Info=True; User Id=edfiPService; Password=edfiPService;" providerName="System.Data.SqlClient" />
<!-- If historical information is going to be displayed you will need a DataWarehouse-->
<add name="DataWarehouse" connectionString="Database=EdFi_DashboardDW; Data Source=(local); Persist Security Info=True; User Id=edfiPService; Password=edfiPService;" providerName="System.Data.SqlClient" />
</connectionStrings>
The Dashboards also support a single connection string for multiple LEAs. In this approach, the connection string setup requires a few preliminary steps in code.
First, edit the code in EdFi.Dashboards.Presentation.Web.Utilities.CastleWindsor.ConfigurationSpecificInstallerBase.cs (if this file does not exist then you need to add it and create a new ConfigurationSpecificInstallerBase
class that inherits from the Core implementation):
public class ConfigurationSpecificInstallerBase : Core.Utilities.CastleWindsor.ConfigurationSpecificInstallerBase
Next, override the default implementation of RegisterIDbConnectionStringSelector
:
protected override void RegisterIDbConnectionStringSelector(IWindsorContainer container)
Also edit the code in EdFi.Dashboards.SecurityTokenService.Web.Utilities.CastleWindsor.ConfigurationSpecificInstallerBase.cs. Specifically, in the RegisterIDbConnectionStringSelector
method you need to replace:
container.Register(Component
.For<IDbConnectionStringSelector>()
.ImplementedBy<LocalEducationAgencyContextConnectionStringSelector>());
...with the new code:
container.Register(Component
.For<IDbConnectionStringSelector>()
.Instance(new NamedDbConnectionStringSelector("Multi_LEA")));
In the Web.config files for both EdFi.Dashboards.Presentation.Web and EdFi.Dashboards.SecurityTokenService.Web you need to add a connection string for Multi_LEA
that follows this pattern:
<add name="Multi_LEA" connectionString="Database=LEA_Dashboard; Data Source=(local); Persist Security Info=True; User Id=userName; Password=passWord;" providerName="System.Data.SqlClient" />