2

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

Community
  • 1
  • 1
Mikael Guldborg
  • 285
  • 1
  • 11
  • How was the metadata created? Was it from Entity Framework, OData or was it manually created. If from EF, make sure that the EF model works properly first (independent of breeze). – Jay Traband Nov 18 '13 at 17:38
  • The metadata was created by an EFContextProvider, that was creating it based on a code-first model with a DbContext. The code-first model is based around conventions and attributes, and does not use the fluent API. There are no issues with the model in EF6, where I have been using it for a while. I have tried looking at the data that goes over the wire with Fiddle as well, and all data is always sent, both children and parent. I am using two seperate queries to do this. – Mikael Guldborg Nov 19 '13 at 07:38

0 Answers0