-
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
builder.Entity<>().Property().Metadata.SetAfterSaveBehavior()
cannot be used with .HasOne()
on the same prop
#33945
Comments
@n0099 Using |
So currently it's not possible to ignore any further updates on the related entity being navigatied? |
@n0099 Correct. |
Does this also applies to b.Entity<LatestReplier>().HasOne<ThreadPost>().WithOne(e => e.LatestReplier).HasForeignKey<ThreadPost>(e => e.LatestReplierId);
b.Entity<ThreadPost>().Property(e => e.LatestReplier).Metadata.SetValueComparer(new ValueComparer<LatestReplier>(
// ^^^^^^^^^^^^^^^^
// System.InvalidOperationException: The property or navigation 'LatestReplier' cannot be added to the 'ThreadPost' type because a property or navigation with the same name already exists on the 'ThreadPost' type.
(x, y) =>
ThreadLatestReplierSaver.UniqueLatestReplier.FromLatestReplier(x)
== ThreadLatestReplierSaver.UniqueLatestReplier.FromLatestReplier(y),
i => ThreadLatestReplierSaver.UniqueLatestReplier.FromLatestReplier(i).GetHashCode())); |
@n0099 Yes. |
Ask a question
IMutableProperty.SetAfterSaveBehavior()
cannot be used withEntityTypeBuilder<>.HasOne()
on the same property.Include your code
https://github.com/n0099/open-tbm/blob/d482259e42fcc5d016c46f839aecc4552425ae66/c%23/crawler/src/Db/CrawlerDbContext.cs#L72
or flip order of lines
Include stack traces
Include provider and version information
EF Core version:
Microsoft.EntityFrameworkCore@8.0.6
Database provider:
Npgsql.EntityFrameworkCore.PostgreSQL@8.0.4
Target framework:
.NET8
Operating system:
Windows 11
IDE:
Visual Studio 2022 17.10.1
The text was updated successfully, but these errors were encountered: