Skip to content
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

Adding entity to NavigationSet in base class using TPH #16

Open
Ron2005 opened this issue Aug 20, 2015 · 0 comments
Open

Adding entity to NavigationSet in base class using TPH #16

Ron2005 opened this issue Aug 20, 2015 · 0 comments

Comments

@Ron2005
Copy link

Ron2005 commented Aug 20, 2015

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant