From d31121e3078f18433e2d275e88eb2477e88b0de9 Mon Sep 17 00:00:00 2001 From: Robert McRackan Date: Tue, 20 Jul 2021 14:43:08 -0400 Subject: [PATCH] Bug fix to address #59 --- DtoImporterService/ContributorImporter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DtoImporterService/ContributorImporter.cs b/DtoImporterService/ContributorImporter.cs index 0f7dcc21..3eb51f07 100644 --- a/DtoImporterService/ContributorImporter.cs +++ b/DtoImporterService/ContributorImporter.cs @@ -71,7 +71,8 @@ namespace DtoImporterService foreach (var p in people) { - var person = DbContext.Contributors.Local.SingleOrDefault(c => c.Name == p.Name); + // Should be 'Single' not 'First'. A user had a duplicate get in somehow though so I'm now using 'First' defensively + var person = DbContext.Contributors.Local.FirstOrDefault(c => c.Name == p.Name); if (person == null) { person = DbContext.Contributors.Add(new Contributor(p.Name, p.Asin)).Entity;