0
votes

I'm using multiple managers in my application. Immediately after creating a new manager, I do this (pseudocode):

newManager.importEntities(existingManager.exportEntities());

in the existing manager, all entities are working as expected, and have all navigation properties populated correctly. but in the new manager, some entities have null navigation properties. the foreign key properties are populated, but the navigation properties are null.

existing manager:

ParentEntity
id = 1
childEntities = [childEntity]

ChildEntity
id = 2
parentEntity = parentEntity
parentEntityId = 1

new manager:

ParentEntity
id = 1
childEntities = []

ChildEntity
id = 2
parentEntity = null
parentEntityId = 1

this is happening for only a couple of entities. the vast majority of entities are correctly created in the manager with navigation properties as expected. but i can't see anything different about the entities that are not importing correctly. what could be causing this to happen?

1
Could any of these be many-many relations? And are you sure that the navigation props were populated when you exported. The existence of a foreign key does not mean that the related entity has already been fetched. - Jay Traband
no many-many relations. just before the export/import, i can see that the navigation properties of the entities that are importing incorrectly are present in the entities in the existing manager. not just the foreign key properties...the full navigation property entities are populated. just double-checked and they're definitely there. - almaplayera
some additional info: 1) when i take a look at the output of existingManager.exportEntities(), i can see that all of the entities in question seem to be present as expected. the entities of the type I referred to as "ParentEntity" (i.e., the type of the missing navigation properties), are at the very end of the output of exportEntities(). 2) as a troubleshooting step, i tried exporting/importing all entities of each entity type, one entity type at a time. all navigation properties are correctly populated in the new manager's entities using this approach - almaplayera

1 Answers

0
votes

What version of Breeze are you using?

We had a similar issue reported a while back, but it was fixed on version 1.3.2.

Back then, the issue was happening with backingStore and was related to the initializationFn parameter in registerEntityTypeCtor. The workaround was to not set initializationFn, but to call a method with initializationFn code after the entity was created.

Once again, the issue above was fixed in version 1.3.2.

If you are using version 1.3.2 or above and still have the problem, please create a small solution reproducing the issue and send it to [email protected]

=================================

Edit:

We just released version 1.4.1 which has a fix for a bug where EntityManager.importEntities did not not always fixup relationships completely in complex graphs.

You might want to try this latest version in case the fix on 1.3.2 does not solve your problem.