Aspnetcore.docs: DbSet.Any() is marked as an internal API not meant for public use.

Created on 7 Jan 2020  Â·  4Comments  Â·  Source: dotnet/AspNetCore.Docs

When building the code in this tutorial, I get this warning when building:

SeedData.cs(16, 31): [EF1001] Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release.

I checked the api docs for EF Core 3.1, and don't see an Any() method. Is there some alternative way of checking whether a DbSet is empty?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Source - Docs.ms needs-more-info

Most helpful comment

Need to add directive "using System.Linq". that will allow you to use the System.Linq.Queryable.Any (...) method and there will be no such notification. Without this directive, he tries to use Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions.Any (...) which is internal to EfCore.

All 4 comments

Are you talking about if (context.Movie.Any())?

That compiles without warning.

That's so weird! I'm using Jetbrains Rider, and I'm seeing this warning:

Screen Shot 2020-01-08 at 5 48 52 PM

Maybe it's a Rider issue and not EF Core. I'm using the latest version of all packages. Sorry that I didn't research that DbSet is an IQueryable, I'm new to C# and am not aware of all the relationships between library classes.

Need to add directive "using System.Linq". that will allow you to use the System.Linq.Queryable.Any (...) method and there will be no such notification. Without this directive, he tries to use Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions.Any (...) which is internal to EfCore.

Was this page helpful?
0 / 5 - 0 ratings