Move using statements to globalusing file

This commit is contained in:
Sumit Ghosh 2021-10-13 17:37:01 +05:30
parent 5fd90e8cb6
commit 9d73669d86
6 changed files with 172 additions and 206 deletions

View File

@ -1,10 +1,10 @@
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
public enum EventStateEnum
{ {
public enum EventStateEnum
{
NotPublished = 0, NotPublished = 0,
InProgress = 1, InProgress = 1,
Published = 2, Published = 2,
PublishedFailed = 3 PublishedFailed = 3
}
} }

View File

@ -1,10 +1,7 @@
using Microsoft.EntityFrameworkCore; namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF public class IntegrationEventLogContext : DbContext
{ {
public class IntegrationEventLogContext : DbContext
{
public IntegrationEventLogContext(DbContextOptions<IntegrationEventLogContext> options) : base(options) public IntegrationEventLogContext(DbContextOptions<IntegrationEventLogContext> options) : base(options)
{ {
} }
@ -41,5 +38,4 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
.IsRequired(); .IsRequired();
} }
}
} }

View File

@ -1,13 +1,7 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using System;
using System.Text.Json;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF public class IntegrationEventLogEntry
{ {
public class IntegrationEventLogEntry
{
private IntegrationEventLogEntry() { } private IntegrationEventLogEntry() { }
public IntegrationEventLogEntry(IntegrationEvent @event, Guid transactionId) public IntegrationEventLogEntry(IntegrationEvent @event, Guid transactionId)
{ {
@ -39,5 +33,4 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
IntegrationEvent = JsonSerializer.Deserialize(Content, type, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true }) as IntegrationEvent; IntegrationEvent = JsonSerializer.Deserialize(Content, type, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true }) as IntegrationEvent;
return this; return this;
} }
}
} }

View File

@ -1,17 +1,10 @@
using Microsoft.EntityFrameworkCore.Storage; namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services public interface IIntegrationEventLogService
{ {
public interface IIntegrationEventLogService
{
Task<IEnumerable<IntegrationEventLogEntry>> RetrieveEventLogsPendingToPublishAsync(Guid transactionId); Task<IEnumerable<IntegrationEventLogEntry>> RetrieveEventLogsPendingToPublishAsync(Guid transactionId);
Task SaveEventAsync(IntegrationEvent @event, IDbContextTransaction transaction); Task SaveEventAsync(IntegrationEvent @event, IDbContextTransaction transaction);
Task MarkEventAsPublishedAsync(Guid eventId); Task MarkEventAsPublishedAsync(Guid eventId);
Task MarkEventAsInProgressAsync(Guid eventId); Task MarkEventAsInProgressAsync(Guid eventId);
Task MarkEventAsFailedAsync(Guid eventId); Task MarkEventAsFailedAsync(Guid eventId);
}
} }

View File

@ -1,17 +1,7 @@
using Microsoft.EntityFrameworkCore; namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services public class IntegrationEventLogService : IIntegrationEventLogService, IDisposable
{ {
public class IntegrationEventLogService : IIntegrationEventLogService, IDisposable
{
private readonly IntegrationEventLogContext _integrationEventLogContext; private readonly IntegrationEventLogContext _integrationEventLogContext;
private readonly DbConnection _dbConnection; private readonly DbConnection _dbConnection;
private readonly List<Type> _eventTypes; private readonly List<Type> _eventTypes;
@ -106,5 +96,4 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi
Dispose(disposing: true); Dispose(disposing: true);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
}
} }

View File

@ -1,11 +1,7 @@
using Microsoft.EntityFrameworkCore; namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utilities;
using System;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utilities public class ResilientTransaction
{ {
public class ResilientTransaction
{
private DbContext _context; private DbContext _context;
private ResilientTransaction(DbContext context) => private ResilientTransaction(DbContext context) =>
_context = context ?? throw new ArgumentNullException(nameof(context)); _context = context ?? throw new ArgumentNullException(nameof(context));
@ -27,5 +23,4 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utili
} }
}); });
} }
}
} }