Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 3091 was 2846, checked in by kgrading, 15 years ago

various improvements (#828) concerning the stability of the server

File size: 1017 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.