From 389aaff0139e9bc24a98eb379efa9e7fb36dc6e6 Mon Sep 17 00:00:00 2001 From: Joni Date: Tue, 3 Jul 2018 16:17:52 +0900 Subject: [PATCH] Convert some magic strings to use "nameof" operator --- .../Services/IntegrationEventLogService.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs index 5ac8bb862..a12309482 100644 --- a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs +++ b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs @@ -1,12 +1,10 @@ using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; +using System; using System.Data.Common; using System.Linq; using System.Threading.Tasks; -using System; -using Microsoft.EntityFrameworkCore.Diagnostics; namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services { @@ -17,7 +15,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi public IntegrationEventLogService(DbConnection dbConnection) { - _dbConnection = dbConnection?? throw new ArgumentNullException("dbConnection"); + _dbConnection = dbConnection ?? throw new ArgumentNullException(nameof(dbConnection)); _integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder() .UseSqlServer(_dbConnection) @@ -27,13 +25,13 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi public Task SaveEventAsync(IntegrationEvent @event, DbTransaction transaction) { - if(transaction == null) + if (transaction == null) { - throw new ArgumentNullException("transaction", $"A {typeof(DbTransaction).FullName} is required as a pre-requisite to save the event."); + throw new ArgumentNullException(nameof(transaction), $"A {typeof(DbTransaction).FullName} is required as a pre-requisite to save the event."); } - + var eventLogEntry = new IntegrationEventLogEntry(@event); - + _integrationEventLogContext.Database.UseTransaction(transaction); _integrationEventLogContext.IntegrationEventLogs.Add(eventLogEntry);