Skip to content

Improve warning message for warning "The same entity is being tracked as different weak entity types"? #20474

Description

@vflame

Currently when owned entities reference a static instance (e.g., a enumeration), we see the following: The same entity is being tracked as different weak entity types 'Order.Fees#Currency' and 'Order.TotalCost#Currency'. If a property value changes it will result in two store changes, which might not be the desired outcome. which isn't very clear as to what the steps to resolve the issue/work around it are. Alluding to ensuring all owned entities are required to be new instances and not shared would be more clear. What's the behavior if the warning is ignored? I'm not seeing the "two store" changes effect.

Activity

  1. added this to the 5.0.0 milestone on Apr 3, 2020
  2. modified the milestones: 5.0.0, Backlog on Apr 3, 2020
  3. Alksar commented on Aug 3, 2020

    @Alksar

    How to suppress this warning? I use owned types for immutable value objects that cannot be changed. In this case, it is convenient to use shared object.

    What's the behavior if the warning is ignored? I'm not seeing the "two store" changes effect.

    The "two store" changes effect will be when you change the shared owned entity before calling SaveChanges.

  4. AndriySvyryd commented on Aug 3, 2020

    @AndriySvyryd
    Member

    .ConfigureWarnings(w => w.Ignore(CoreEventId.DuplicateDependentEntityTypeInstanceWarning))

  5. vflame commented on Oct 8, 2020

    @vflame
    Author

    How to suppress this warning? I use owned types for immutable value objects that cannot be changed. In this case, it is convenient to use shared object.

    What's the behavior if the warning is ignored? I'm not seeing the "two store" changes effect.

    The "two store" changes effect will be when you change the shared owned entity before calling SaveChanges.

    As in value change or as in reference change?

  6. ajcvickers commented on Oct 19, 2020

    @ajcvickers
    Contributor

    @vflame Mutation.

  7. modified the milestones: Backlog, MQ on Oct 20, 2021
  8. modified the milestones: MQ, Backlog on Oct 26, 2022
  9. CaringDev commented on Aug 14, 2024

    @CaringDev
    Contributor

    .ConfigureWarnings(w => w.Ignore(CoreEventId.DuplicateDependentEntityTypeInstanceWarning))

    Would be perfect if configurable per entity type. In general, the warning is fine, I'd like to suppress it for (manually) verified immutable types.

  10. removed their assignment
    on Aug 31, 2024
  11. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions