Breeze / breeze.server.net

Breeze support for .NET servers
MIT License
76 stars 62 forks source link

Duplicate owned entity causes MetadataBuilder to throw ArgumentException #190

Closed aquisio closed 1 year ago

aquisio commented 1 year ago

My application uses a schema in which one of the entity types has two properties of the same owned entity type:

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Entity<Listing>().OwnsOne(c => c.BuyerAddress);
            modelBuilder.Entity<Listing>().OwnsOne(c => c.SellerAddress);
        }

With this configuration, MetadataBuilder.BuildFrom(), throws an ArgumentException: 'An item with the same key has already been added. Key: Address'.

Is this a bug, or perhaps something that can be resolved with a change of model builder configuration?

Any advice will be much appreciated. Thanks.

steveschmitt commented 1 year ago

That sounds like issue #186 which was fixed in version 7.1.0. What version of breeze are you using?

aquisio commented 1 year ago

Apologies - you're right. Just updated to 7.1.0 and the issue is gone. Thanks.