Rev | Line | |
---|
[1724] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using HeuristicLab.PluginInfrastructure;
|
---|
| 6 | using HeuristicLab.DataAccess.Interfaces;
|
---|
| 7 | using System.Runtime.CompilerServices;
|
---|
| 8 | using System.Data.SqlClient;
|
---|
| 9 |
|
---|
| 10 | namespace HeuristicLab.Security.Core {
|
---|
| 11 | class ServiceLocator {
|
---|
| 12 | private static DiscoveryService discoveryService =
|
---|
| 13 | new DiscoveryService();
|
---|
| 14 |
|
---|
| 15 | private static ISessionFactory sessionFactory = null;
|
---|
| 16 |
|
---|
| 17 | /// <summary>
|
---|
| 18 | /// Gets the db session factory
|
---|
| 19 | /// </summary>
|
---|
| 20 | /// <returns></returns>
|
---|
| 21 | [MethodImpl(MethodImplOptions.Synchronized)]
|
---|
| 22 | public static ISessionFactory GetSessionFactory() {
|
---|
| 23 | if (sessionFactory == null) {
|
---|
| 24 | sessionFactory =
|
---|
| 25 | discoveryService.GetInstances<ISessionFactory>()[0];
|
---|
| 26 |
|
---|
| 27 | sessionFactory.DbConnectionType =
|
---|
| 28 | typeof(SqlConnection);
|
---|
| 29 |
|
---|
| 30 | sessionFactory.DbConnectionString =
|
---|
| 31 | HeuristicLab.Security.Core.Properties.Settings.Default.SecurityServerConnectionString;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | return sessionFactory;
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.