Code re-factorings and formatting in IntegrationEventLogEF project
This commit is contained in:
parent
0705dc0ab5
commit
1d377f7808
@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
|
|
||||||
{
|
{
|
||||||
public enum EventStateEnum
|
public enum EventStateEnum
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
using System;
|
using DateTime = System.DateTime;
|
||||||
using System.Collections.Generic;
|
using Guid = System.Guid;
|
||||||
using System.Text;
|
using JsonConvert = Newtonsoft.Json.JsonConvert;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
|
||||||
{
|
{
|
||||||
|
using IntegrationEvent = EventBus.Events.IntegrationEvent;
|
||||||
|
|
||||||
public class IntegrationEventLogEntry
|
public class IntegrationEventLogEntry
|
||||||
{
|
{
|
||||||
private IntegrationEventLogEntry() { }
|
private IntegrationEventLogEntry() { }
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
using DbTransaction = System.Data.Common.DbTransaction;
|
||||||
using System;
|
using Task = System.Threading.Tasks.Task;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.Common;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services
|
||||||
{
|
{
|
||||||
|
using IntegrationEvent = EventBus.Events.IntegrationEvent;
|
||||||
|
|
||||||
public interface IIntegrationEventLogService
|
public interface IIntegrationEventLogService
|
||||||
{
|
{
|
||||||
Task SaveEventAsync(IntegrationEvent @event, DbTransaction transaction);
|
Task SaveEventAsync(IntegrationEvent @event, DbTransaction transaction);
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
using static System.Linq.Enumerable;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
using ArgumentNullException = System.ArgumentNullException;
|
||||||
using System;
|
using DbConnection = System.Data.Common.DbConnection;
|
||||||
using System.Data.Common;
|
using DbTransaction = System.Data.Common.DbTransaction;
|
||||||
using System.Linq;
|
using RelationalEventId = Microsoft.EntityFrameworkCore.Diagnostics.RelationalEventId;
|
||||||
using System.Threading.Tasks;
|
using Task = System.Threading.Tasks.Task;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services
|
||||||
{
|
{
|
||||||
|
using IntegrationEvent = EventBus.Events.IntegrationEvent;
|
||||||
|
|
||||||
public class IntegrationEventLogService : IIntegrationEventLogService
|
public class IntegrationEventLogService : IIntegrationEventLogService
|
||||||
{
|
{
|
||||||
private readonly IntegrationEventLogContext _integrationEventLogContext;
|
private readonly IntegrationEventLogContext _integrationEventLogContext;
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using static Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions;
|
||||||
using Microsoft.EntityFrameworkCore.Storage;
|
using ArgumentNullException = System.ArgumentNullException;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
using DbContext = Microsoft.EntityFrameworkCore.DbContext;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
|
using Task = System.Threading.Tasks.Task;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.Common;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utilities
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utilities
|
||||||
{
|
{
|
||||||
|
using FuncOfTask = System.Func<Task>;
|
||||||
|
|
||||||
public class ResilientTransaction
|
public class ResilientTransaction
|
||||||
{
|
{
|
||||||
private DbContext _context;
|
private DbContext _context;
|
||||||
@ -19,7 +17,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utili
|
|||||||
public static ResilientTransaction New(DbContext context) =>
|
public static ResilientTransaction New(DbContext context) =>
|
||||||
new ResilientTransaction(context);
|
new ResilientTransaction(context);
|
||||||
|
|
||||||
public async Task ExecuteAsync(Func<Task> action)
|
public async Task ExecuteAsync(FuncOfTask action)
|
||||||
{
|
{
|
||||||
//Use of an EF Core resiliency strategy when using multiple DbContexts within an explicit BeginTransaction():
|
//Use of an EF Core resiliency strategy when using multiple DbContexts within an explicit BeginTransaction():
|
||||||
//See: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
|
//See: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
|
||||||
|
Loading…
x
Reference in New Issue
Block a user