using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.Common; using System.Data.SqlClient; using HeuristicLab.Tracing; namespace HeuristicLab.Hive.Server.LINQDataAccess { public class ContextFactory { [ThreadStatic] private static HiveDataContext _hiveDataContext = null; [ThreadStatic] private static SqlTransaction _currentTransaction = null; public static HiveDataContext Context { get { if (_hiveDataContext == null) { Logger.Debug("Requested new Data Context"); _hiveDataContext = new HiveDataContext("Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq.Test;Integrated Security=SSPI"); _hiveDataContext.CommandTimeout = 240; } return _hiveDataContext; } set { _hiveDataContext = value; } } public static SqlTransaction CurrentTransaction { get { return _currentTransaction; } set { _currentTransaction = value; } } public static bool IsContextNull() { return _hiveDataContext == null; } } }