问题
I have a model where I have a two entities, a "Parent" and a "Child".
The relationship should be obvious but goes: Parent has zero or more Child entities.
The Parent has a navigation property called "Children" with a collection of Child entities.
The Child does NOT have a navigation property back to the parent. It only has a foreign key leading back to the parent.
When I load these models into my EntityManager, the "Children" navigation property collection is only ever populated with 1 child, even though the given Parent entity in fact have several.
I have tried adding a "Parent" navigation property to the "Child" entity, and if I do this, the "Children" navigation property on the "Parent" entity is populated correctly with all Child entities when loaded in the EntityManager.
The problem is that this is not an option.
If it helps, I am not using the "Knockout" models, but rather the "backingStore" library for Angular model binding.
I have seen the question on the following link, which describes a rather similar issue (although, supposedly fixed and for a much older version of Breeze): Child entities not populated without inverse property
来源:https://stackoverflow.com/questions/20045999/breeze-1-4-5-unidirectional-one-to-many-navigation-collection-not-populated