-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/Rebus.Configuration/Rebus.Configuration.SqlServerSelectors/SqlServerDataBusOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Dbosoft.Rebus.Configuration; | ||
|
||
public class SqlServerDataBusOptions | ||
{ | ||
public string TableName { get; set; } | ||
|
||
public bool AutomaticallyCreateTables { get; set; } | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Rebus.Configuration/Rebus.Configuration.SqlServerSelectors/SqlServerDataBusSelector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
using Rebus.Config; | ||
using Rebus.DataBus; | ||
|
||
namespace Dbosoft.Rebus.Configuration; | ||
|
||
public class SqlServerDataBusSelector : SqlServerSelectorBase<IDataBusStorage> | ||
{ | ||
private readonly IOptions<SqlServerDataBusOptions> _options; | ||
|
||
public SqlServerDataBusSelector(IOptions<SqlServerDataBusOptions> options, IConfiguration configuration, ILogger log) | ||
: base(configuration, log) | ||
{ | ||
_options = options; | ||
} | ||
|
||
public override string ConfigurationName => "store"; | ||
protected override void ConfigureSqlServer(StandardConfigurer<IDataBusStorage> configurer, string connectionString) | ||
{ | ||
configurer.StoreInSqlServer(connectionString, | ||
_options.Value.TableName, _options.Value.AutomaticallyCreateTables); | ||
} | ||
} |