0

Is it possible to inject a Guid provider to aspnet / EF core so that two test runs produces the identical database content?

I'd like to diff the dump of two databases but randomised ids are a problem. I currently remove the ids but it makes the diff less than idea.

daw
  • 1,959
  • 1
  • 20
  • 25

1 Answers1

1

You can override this behavior with Fluent API

modelBuilder.Entity<MyEntity>()
            .Property(x => x.Id)
            .HasDefaultValue(MyGuidProvider());

As for actually creating MyGuidProvider() I unfortunately can't be of much help, you can try checking out this question

Adam Vincent
  • 3,281
  • 14
  • 38