-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while diffing spatial seed data #18729
Comments
Possibly external (NetTopologySuite/NetTopologySuite#213) |
Didn't we switch to EqualsExact for query translation? We may want to do the same for the value comparer... |
This may have been fixed by that change. I didn’t try reproing again |
I seem to get this on
|
I tried to upgrade to 5-preview4 and the issue seems to be resolved there. Is there any workaround for EF Core 3? Not sure I want to use a preview version in production... |
@OskarKlintrot you can copy GeometryValueComparer.cs and make the switch to EqualsExact just like #18946 did. See these docs about value comparers. |
@roji Thanks, that shouldn't be any problem! I where just looking through the source code instead of the docs to see how to get it working, I followed the |
@OskarKlintrot yep, you shouldn't need to do anything with the plugin - just configure the modified value comparer on the spatial properties where this is a problem. |
@roji Looks like it's working now! It didn't work for the InMemory-db though ("fixed" it with |
Given this discussion it seems this could be a duplicate of #18921 ans is therefore likely fixed. |
Confirmed, repro'd the bug on 3.1.4, and it's gone in 5.0.0-preview4. Reproclass Program
{
static async Task Main(string[] args)
{
await using var ctx = new BlogContext();
await ctx.Database.EnsureDeletedAsync();
await ctx.Database.EnsureCreatedAsync();
}
}
public class BlogContext : DbContext
{
public DbSet<Blog> Blogs { get; set; }
static ILoggerFactory ContextLoggerFactory
=> LoggerFactory.Create(b => b.AddConsole().AddFilter("", LogLevel.Information));
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseNpgsql(@"Host=localhost;Username=test;Password=test", o => o.UseNetTopologySuite())
.EnableSensitiveDataLogging()
.UseLoggerFactory(ContextLoggerFactory);
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasPostgresExtension("postgis");
modelBuilder.Entity<Blog>().HasData(new Blog
{
Id = 1,
SomeGeometry = new GeometryCollection(new[] { new Point(1, 1) })
});
}
}
public class Blog
{
public int Id { get; set; }
public Geometry SomeGeometry { get; set; }
} |
Duplicate of #18921 |
Diffing the model snapshot against the original model in
ModelSnapshotSqlServerTest.SeedData_annotations_are_stored_in_snapshot()
results in the following exception.The text was updated successfully, but these errors were encountered: