You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There appears to be a bug when adding a new entity to a NavigationSet in Breeze.Sharp .Net.
This happens under the following conditions:
Using TPH to map entities. The base abstract entity has a 0-many unidirectional mapping to another entity. For example abstract Person has a collection of PhoneNumber(s), but PhoneNumber does not map back to Person (it only has the PersonID foreign key)
There are multiple derived subclasses of Person type
The client side data model has been created that maps to Person, its subclasess, and the NavigationSet to include the PhoneNumbers collection
Using the Breeze.Sharp client, the Person entities are queried and returned and expanded to include the PhoneNumbers collection.
If you try to add a new PhoneNumber to the NavigationSet of a Person, it throws the below exception. On investigation it seems when the metadata of the context from the server is processed, the inverse navigation properties are duplicated for every subtype of Person.
Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List1.get_Item(Int32 index) at Breeze.Sharp.NavigationSet1.<>c__DisplayClass7.b__4(DataProperty fkp, Int32 i)
at Breeze.Sharp.Core.EnumerableFns.ForEach[T](IEnumerable1 items, Action2 action)
at Breeze.Sharp.NavigationSet1.ConnectRelated(IEntity entity) at Breeze.Sharp.NavigationSet1.InsertItem(Int32 index, T entity)
at System.Collections.ObjectModel.Collection1.Add(T item) at Breeze.Sharp.NavigationSet1.Breeze.Sharp.INavigationSet.Add(IEntity entity)
at Breeze.Sharp.EntityAspect.UpdateRelated(DataProperty property, Object newValue, Object oldValue)
at Breeze.Sharp.EntityAspect.SetDpValueSimple(DataProperty property, Object newValue, Object oldValue)
at Breeze.Sharp.EntityAspect.SetDpValueCore(DataProperty property, Object newValue, Object oldValue)
at Breeze.Sharp.EntityAspect.SetValueWithEvents[T](T property, Object newValue, Action`3 action)
at Breeze.Sharp.EntityAspect.SetDpValue(DataProperty property, Object newValue)
at Breeze.Sharp.EntityAspect.SetValue(StructuralProperty property, Object newValue)
at Breeze.Sharp.EntityAspect.SetValue(String propertyName, Object newValue)
at Breeze.Sharp.BaseEntity.SetValue(Object value, String propertyName)
The text was updated successfully, but these errors were encountered:
There appears to be a bug when adding a new entity to a NavigationSet in Breeze.Sharp .Net.
This happens under the following conditions:
Using TPH to map entities. The base abstract entity has a 0-many unidirectional mapping to another entity. For example abstract Person has a collection of PhoneNumber(s), but PhoneNumber does not map back to Person (it only has the PersonID foreign key)
There are multiple derived subclasses of Person type
The client side data model has been created that maps to Person, its subclasess, and the NavigationSet to include the PhoneNumbers collection
Using the Breeze.Sharp client, the Person entities are queried and returned and expanded to include the PhoneNumbers collection.
If you try to add a new PhoneNumber to the NavigationSet of a Person, it throws the below exception. On investigation it seems when the metadata of the context from the server is processed, the inverse navigation properties are duplicated for every subtype of Person.
Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List
1.get_Item(Int32 index) at Breeze.Sharp.NavigationSet
1.<>c__DisplayClass7.b__4(DataProperty fkp, Int32 i)at Breeze.Sharp.Core.EnumerableFns.ForEach[T](IEnumerable
1 items, Action
2 action)at Breeze.Sharp.NavigationSet
1.ConnectRelated(IEntity entity) at Breeze.Sharp.NavigationSet
1.InsertItem(Int32 index, T entity)at System.Collections.ObjectModel.Collection
1.Add(T item) at Breeze.Sharp.NavigationSet
1.Breeze.Sharp.INavigationSet.Add(IEntity entity)at Breeze.Sharp.EntityAspect.UpdateRelated(DataProperty property, Object newValue, Object oldValue)
at Breeze.Sharp.EntityAspect.SetDpValueSimple(DataProperty property, Object newValue, Object oldValue)
at Breeze.Sharp.EntityAspect.SetDpValueCore(DataProperty property, Object newValue, Object oldValue)
at Breeze.Sharp.EntityAspect.SetValueWithEvents[T](T property, Object newValue, Action`3 action)
at Breeze.Sharp.EntityAspect.SetDpValue(DataProperty property, Object newValue)
at Breeze.Sharp.EntityAspect.SetValue(StructuralProperty property, Object newValue)
at Breeze.Sharp.EntityAspect.SetValue(String propertyName, Object newValue)
at Breeze.Sharp.BaseEntity.SetValue(Object value, String propertyName)
The text was updated successfully, but these errors were encountered: