public static IOrganisationKeyRepository GetOrganisationKeyRepository(DatabaseEngineConstant databaseEngineOption, string connectionString, IRepoTransaction repoTransaction) { switch (databaseEngineOption) { case DatabaseEngineConstant.MSSQLADODOTNET: { RepoTransactionMsSql repoTransactionMsSql = repoTransaction as RepoTransactionMsSql; if (repoTransactionMsSql == null) { string message = "Wrong Repo transaction type is injected into OrganisationKeyRepoFactory to be used with MSSQL."; throw new ApplicationException(message); } IOrganisationKeyRepository organisationKeyRepository = new DbRepository.ADO.OrganisationKeyRepositoryMsSql(connectionString, repoTransaction); return(organisationKeyRepository); } default: { throw new InvalidOperationException("The option assigned to the OrganisationKeyRepoFactory does " + "not exist in the factories internal collection"); } } }
private void PersistMessagedispatch(MessageDispatch messageDispatch, IRepoTransaction repoTransaction) { IMessageDispatchRepository dispatchRepo = MessageDispatchRepoFactory.GetDispatchRepository(DatabaseOption.DatabaseEngine, DatabaseOption.DbConnectionString, repoTransaction); dispatchRepo.InsertDispatch(messageDispatch); WriteInfoLog("Message-Dispatch persisting was successful."); }
private void PersistMessage(Message message, IRepoTransaction repoTransaction) { DatabaseEngineConstant databaseEngine = DatabaseOption.DatabaseEngine; IMessageRepository messageRepo = MessageRepoFactory.GetMessageRepository(databaseEngine, DatabaseOption.DbConnectionString, repoTransaction); messageRepo.InsertMessage(message); WriteInfoLog("Message persisting was successful."); }
private void ProcessMessageDispatch(IMessageContract messageContract, Message message, IRepoTransaction repoTransaction) { foreach (var emailAddress in messageContract.EmailAccounts) { MessageDispatch messageDispatch = new MessageDispatch { EmailAddress = emailAddress, MessageId = message.Id, MessageReceived = false }; PersistMessagedispatch(messageDispatch, repoTransaction); } }
private void ProcessNewMessage(IMessageContract messageContract, Message message) { using (IRepoTransaction repoTransaction = RepoTransactionFactory.GetRepoTransaction(DatabaseOption.DatabaseEngine, DatabaseOption.DbConnectionString)) { try { repoTransaction.BeginTransaction(); PersistMessage(message, repoTransaction); ProcessMessageDispatch(messageContract, message, repoTransaction); repoTransaction.Commit(); } catch (Exception exception) { WriteErrorLog("Unable to process new message request.", exception); repoTransaction.Callback(); throw; } } }
public AuthorisationRepositoryMsSql(string connectionString, IRepoTransaction repoTransaction) { this.connectionString = connectionString; this.repoTransaction = repoTransaction; this.transactionModeEnabled = true; }
public MessageDispatchRepositoryMsSql(string connectionString, IRepoTransaction repoTransaction) { this.connectionString = connectionString; this.repoTransaction = repoTransaction; this.transactionModeEnabled = true; }
public ATMCustomer(IMessagePrinter msgPrinter, IRepoTransaction repoTransaction) { _msgPrinter = msgPrinter; _repoTransaction = repoTransaction; }