private void ConfigureServiceHost(DbConnectionImpl dbConnection) { _host = new WebServiceHost(new MailServerStub(dbConnection), new Uri("http://localhost:4000/")); //var smb = _host.Description.Behaviors.Find<ServiceMetadataBehavior>(); //if (smb == null) //{ // smb = new ServiceMetadataBehavior(); // _host.Description.Behaviors.Add(smb); //} //smb.HttpGetEnabled = true; var behaviour = _host.Description.Behaviors.Find<ServiceBehaviorAttribute>(); behaviour.InstanceContextMode = InstanceContextMode.Single; var debugBehaviour = _host.Description.Behaviors.Find<ServiceDebugBehavior>(); debugBehaviour.IncludeExceptionDetailInFaults = true; }
private static void InitDatabase(String baseDirectory) { Log.Message("Database initialization"); String sqlScript = File.ReadAllText(baseDirectory + "\\CreateDB.sql"); IEnumerable<string> commandStrings = Regex.Split(sqlScript, @"^\s*GO\s*$", RegexOptions.Multiline | RegexOptions.IgnoreCase); using (DbConnectionImpl connection = new DbConnectionImpl( DbConnectionInfo.CreateTrustedConnection("master"))) { connection.InfoMessage += new SqlInfoMessageEventHandler(connection_InfoMessage); foreach (string queryItem in commandStrings) { try { if (queryItem.Trim() != String.Empty) { String normalizedQuery = NormalizeQuery(queryItem); connection.ExecuteNonQueryServer(normalizedQuery); } } catch (ExecutionFailureException ex) { Exception inner = ex.InnerException; Log.Exception(inner, "Failed to preparing database"); throw; } catch (Exception e) { Log.Exception(e, "Failed to preparing database"); throw; } } } }
public ServerUtils(DbConnectionImpl connection) { _connection = connection; }
public EmployeeHive(DbConnectionImpl dbimpl) { _dbImpl = dbimpl; }
public EmployeeCreationTest() { _testSuffix = String.Format("TEST_{0}", Guid.NewGuid()); _dbConnection = new DbConnectionImpl(DbConnectionInfo.CreateDefault()); _employeeHive = new EmployeeHive(_dbConnection); }
public MailHive(DbConnectionImpl dbImpl) { _dbConnection = dbImpl; }
public MailServerStub(DbConnectionImpl dbConnection) { _serverUtils = new ServerUtils(dbConnection); _mailHive = new MailHive(dbConnection); _employeeHive = new EmployeeHive(dbConnection); }