/// <summary> /// Initializes a new <see cref="SQLMessageJournal"/> with the specified connection /// provider and dialect /// </summary> /// <param name="connectionProvider">The connection provider to use to connect to /// the SQL database</param> /// <param name="commandBuilders">A set of commands that conform to the SQL syntax /// required by the underlying connection provider</param> /// <param name="diagnosticService">(Optional) The service through which diagnostic events /// are reported and processed</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="connectionProvider"/> /// or <paramref name="commandBuilders"/> is <c>null</c></exception> public SQLMessageJournal(IDbConnectionProvider connectionProvider, IMessageJournalingCommandBuilders commandBuilders, IDiagnosticService diagnosticService = null) { DiagnosticService = diagnosticService ?? Diagnostics.DiagnosticService.DefaultInstance; ConnectionProvider = connectionProvider ?? throw new ArgumentNullException(nameof(connectionProvider)); CommandBuilders = commandBuilders ?? throw new ArgumentNullException(nameof(commandBuilders)); }
protected void WhenInitializingBuilders() { var factory = new CommandBuildersFactory(ConnectionStringSettings); MessageJournalingCommandBuilders = factory.InitMessageJournalingCommandBuilders(); MessageQueueingCommandBuilders = factory.InitMessageQueueingCommandBuilders(); SubscriptionTrackingCommandBuilders = factory.InitSubscriptionTrackingCommandBuilders(); }
/// <summary> /// Initializes a new <see cref="SQLMessageJournal"/> with the specified connection /// string settings and dialect /// </summary> /// <param name="connectionStringSettings">The connection string settings to use to connect /// to the SQL database</param> /// <param name="commandBuilders">(Optional) A collection of factories capable of /// generating database commands for manipulating queued messages that conform to the SQL /// syntax required by the underlying connection provider (if needed)</param> /// <param name="diagnosticService">(Optional) The service through which diagnostic events /// are reported and processed</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="connectionStringSettings"/> /// is <c>null</c></exception> /// <remarks> /// If a SQL dialect is not specified, then one will be selected based on the supplied /// connection string settings /// </remarks> /// <seealso cref="CommandBuildersFactory.InitMessageJournalingCommandBuilders"/> /// <seealso cref="IMessageJournalingCommandBuildersProvider"/> public SQLMessageJournal(ConnectionStringSettings connectionStringSettings, IMessageJournalingCommandBuilders commandBuilders = null, IDiagnosticService diagnosticService = null) { if (connectionStringSettings == null) { throw new ArgumentNullException(nameof(connectionStringSettings)); } DiagnosticService = diagnosticService ?? Diagnostics.DiagnosticService.DefaultInstance; ConnectionProvider = new DefaultConnectionProvider(connectionStringSettings, DiagnosticService); CommandBuilders = commandBuilders ?? new CommandBuildersFactory(connectionStringSettings, DiagnosticService) .InitMessageJournalingCommandBuilders(); }