Skip to content

Commit c38316e

Browse files
author
fabien.menager
committed
Improve error handling for keyless entities in MetadataProvider
1 parent 0db7a21 commit c38316e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/PhenX.EntityFrameworkCore.BulkInsert/Metadata/MetadataProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public TableMetadata GetTableInfo<T>(DbContext context)
3434
throw new InvalidOperationException($"The type '{modelType.FullName}' is not part of the model for the current context.");
3535
}
3636

37-
3837
// Filter out entities without an associated table
3938
// See also https://learn.microsoft.com/en-us/ef/core/modeling/keyless-entity-types
4039
if (entityType.GetTableName() is null)
4140
{
41+
throw new InvalidOperationException($"The type '{modelType.FullName}' is not mapped to a table in the database or is keyless.");
4242
}
4343

4444
var provider = context.GetService<IBulkInsertProvider>();

0 commit comments

Comments
 (0)