-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tomasz Maruszak <[email protected]>
- Loading branch information
Showing
82 changed files
with
646 additions
and
369 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
20 changes: 0 additions & 20 deletions
20
src/SlimMessageBus.Host.Outbox.DbContext/Configuration/MessageBusBuilderExtensions.cs
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
src/SlimMessageBus.Host.Outbox.DbContext/DbContextOutboxRepository.cs
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/SlimMessageBus.Host.Outbox.Sql.DbContext/Configuration/MessageBusBuilderExtensions.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,28 @@ | ||
namespace SlimMessageBus.Host.Outbox.Sql.DbContext; | ||
|
||
public static class MessageBusBuilderExtensions | ||
{ | ||
public static MessageBusBuilder AddOutboxUsingDbContext<TDbContext>(this MessageBusBuilder mbb, Action<SqlOutboxSettings> configure) | ||
where TDbContext : Microsoft.EntityFrameworkCore.DbContext | ||
{ | ||
mbb.PostConfigurationActions.Add(services => | ||
{ | ||
services.TryAddScoped<ISqlTransactionService, DbContextTransactionService<TDbContext>>(); | ||
services.TryAddScoped(svp => | ||
{ | ||
var settings = svp.GetRequiredService<SqlOutboxSettings>(); | ||
return new DbContextOutboxRepository<TDbContext>( | ||
svp.GetRequiredService<ILogger<DbContextOutboxRepository<TDbContext>>>(), | ||
settings, | ||
svp.GetRequiredService<SqlOutboxTemplate>(), | ||
settings.IdGeneration.GuidGenerator ?? (IGuidGenerator)svp.GetRequiredService(settings.IdGeneration.GuidGeneratorType), | ||
svp.GetRequiredService<ICurrentTimeProvider>(), | ||
svp.GetRequiredService<IInstanceIdProvider>(), | ||
svp.GetRequiredService<TDbContext>(), | ||
svp.GetRequiredService<ISqlTransactionService>() | ||
); | ||
}); | ||
}); | ||
return mbb.AddOutboxUsingSql<DbContextOutboxRepository<TDbContext>>(configure); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/SlimMessageBus.Host.Outbox.Sql.DbContext/DbContextOutboxRepository.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,28 @@ | ||
namespace SlimMessageBus.Host.Outbox.Sql.DbContext; | ||
|
||
public class DbContextOutboxRepository<TDbContext> : SqlOutboxMessageRepository where TDbContext : Microsoft.EntityFrameworkCore.DbContext | ||
{ | ||
public TDbContext DbContext { get; } | ||
|
||
public DbContextOutboxRepository( | ||
ILogger<DbContextOutboxRepository<TDbContext>> logger, | ||
SqlOutboxSettings settings, | ||
SqlOutboxTemplate sqlOutboxTemplate, | ||
IGuidGenerator guidGenerator, | ||
ICurrentTimeProvider currentTimeProvider, | ||
IInstanceIdProvider instanceIdProvider, | ||
TDbContext dbContext, | ||
ISqlTransactionService transactionService) | ||
: base( | ||
logger, | ||
settings, | ||
sqlOutboxTemplate, | ||
guidGenerator, | ||
currentTimeProvider, | ||
instanceIdProvider, | ||
(SqlConnection)dbContext.Database.GetDbConnection(), | ||
transactionService) | ||
{ | ||
DbContext = dbContext; | ||
} | ||
} |
10 changes: 2 additions & 8 deletions
10
....DbContext/DbContextTransactionService.cs → ....DbContext/DbContextTransactionService.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
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 @@ | ||
global using Microsoft.Data.SqlClient; | ||
global using Microsoft.EntityFrameworkCore; | ||
global using Microsoft.EntityFrameworkCore.Storage; | ||
global using Microsoft.Extensions.DependencyInjection; | ||
global using Microsoft.Extensions.DependencyInjection.Extensions; | ||
global using Microsoft.Extensions.Logging; | ||
|
||
global using SlimMessageBus.Host.Sql.Common; |
File renamed without changes.
Oops, something went wrong.