Skip to content

Commit c01a1f7

Browse files
authored
Merge pull request dotnet-architecture#662 from jo-ninja/UseNameOf
Convert some magic strings to use "nameof" operator
2 parents 9b4ab03 + 389aaff commit c01a1f7

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
using Microsoft.EntityFrameworkCore;
2-
using Microsoft.EntityFrameworkCore.Infrastructure;
3-
using Microsoft.EntityFrameworkCore.Storage;
2+
using Microsoft.EntityFrameworkCore.Diagnostics;
43
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
4+
using System;
55
using System.Data.Common;
66
using System.Linq;
77
using System.Threading.Tasks;
8-
using System;
9-
using Microsoft.EntityFrameworkCore.Diagnostics;
108

119
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services
1210
{
@@ -17,7 +15,7 @@ public class IntegrationEventLogService : IIntegrationEventLogService
1715

1816
public IntegrationEventLogService(DbConnection dbConnection)
1917
{
20-
_dbConnection = dbConnection?? throw new ArgumentNullException("dbConnection");
18+
_dbConnection = dbConnection ?? throw new ArgumentNullException(nameof(dbConnection));
2119
_integrationEventLogContext = new IntegrationEventLogContext(
2220
new DbContextOptionsBuilder<IntegrationEventLogContext>()
2321
.UseSqlServer(_dbConnection)
@@ -27,13 +25,13 @@ public IntegrationEventLogService(DbConnection dbConnection)
2725

2826
public Task SaveEventAsync(IntegrationEvent @event, DbTransaction transaction)
2927
{
30-
if(transaction == null)
28+
if (transaction == null)
3129
{
32-
throw new ArgumentNullException("transaction", $"A {typeof(DbTransaction).FullName} is required as a pre-requisite to save the event.");
30+
throw new ArgumentNullException(nameof(transaction), $"A {typeof(DbTransaction).FullName} is required as a pre-requisite to save the event.");
3331
}
34-
32+
3533
var eventLogEntry = new IntegrationEventLogEntry(@event);
36-
34+
3735
_integrationEventLogContext.Database.UseTransaction(transaction);
3836
_integrationEventLogContext.IntegrationEventLogs.Add(eventLogEntry);
3937

0 commit comments

Comments
 (0)