Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Persistence Test/HeuristicLab.Security.Core/3.2/ServiceLocator.cs @ 3644

Last change on this file since 3644 was 1724, checked in by svonolfe, 16 years ago

Finished security server (#537)

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