Skip to content

Commit e77e2f6

Browse files
author
Bart Koelman
committed
Fixed: suppress warning "Entity does not implement IIdentifiable" for auto-generated join table entities in native many-to-many relationships.
1 parent 3443bf6 commit e77e2f6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/JsonApiDotNetCore/Configuration/JsonApiApplicationBuilder.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Microsoft.AspNetCore.Mvc.ModelBinding;
1919
using Microsoft.EntityFrameworkCore;
2020
using Microsoft.EntityFrameworkCore.Metadata;
21+
using Microsoft.EntityFrameworkCore.Metadata.Internal;
2122
using Microsoft.Extensions.DependencyInjection;
2223
using Microsoft.Extensions.DependencyInjection.Extensions;
2324
using Microsoft.Extensions.Logging;
@@ -283,7 +284,12 @@ private void AddResourcesFromDbContext(DbContext dbContext, ResourceGraphBuilder
283284
{
284285
foreach (IEntityType entityType in dbContext.Model.GetEntityTypes())
285286
{
286-
builder.Add(entityType.ClrType);
287+
#pragma warning disable EF1001 // Internal EF Core API usage.
288+
if (entityType is not EntityType { IsImplicitlyCreatedJoinEntityType: true })
289+
#pragma warning restore EF1001 // Internal EF Core API usage.
290+
{
291+
builder.Add(entityType.ClrType);
292+
}
287293
}
288294
}
289295

0 commit comments

Comments
 (0)