Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,14 @@ static Type FindTypeToInstantiate(Type collectionType, Type elementType)
EnumDefinition? enumDefinition;
if (storeType is null)
{
enumDefinition = _enumDefinitions.SingleOrDefault(m => m.ClrType == clrType);
var matches = _enumDefinitions.Where(m => m.ClrType == clrType).ToList();
if (matches.Count > 1)
{
throw new InvalidOperationException(
$"Multiple enum definitions registered for CLR type '{clrType?.FullName}'. ");
}

enumDefinition = matches.FirstOrDefault();

if (enumDefinition is null)
{
Expand Down