Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Security.Core/3.2/ServiceLocator.cs @ 2591

Last change on this file since 2591 was 2591, checked in by gkronber, 14 years ago

Copied refactored plugin infrastructure from branch and merged changeset r2586:2589 from branch into the trunk. #799

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