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?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
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:
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.
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.