1
votes

In the previous build I used setProperties and ommitted trackingImplementation, I decided to use knockout manually to speed things up, (I have a lot of entities).

Now its changed to this syntax, and even though I comment out the "ko" line, it still creates observables, is there a way to prevent this?

core.config.initializeAdapterInstances({
//        modelLibrary: "ko",
          dataService: "webApi"
});
2
core.config.initializeAdapterInstances({ modelLibrary: "backingStore", dataService: "webApi" }); This seems to do the trick! - user1863703

2 Answers

2
votes

I'm loading around 5000-10000 entities into the cache, these are 'guests' which will be ticked off a guest list during a an evening, I need them stored offline because if I lose connection then app fails to do its job. I'm also running on mobile devices which has an additional hit, when I use KO every entity brought across from server becomes a list of observable properties, this is obviously overkill and crashes safari on iPhone. Instead I wait for the user to do a search from the 10,000 entities using breezejs local query then for each guest in search results instantiate a guest with observables. This allows me the use of knockout for binding and leaves the rest of the entities alone, it works well and performs well on ios devices too. Just having a read of 'extending entities' now

Thanks

0
votes

I see in your comment that you tried ...modelLibrary: backingStore.... I was going to suggest this. But then I worried that your manual KO properties would by-pass the backingStore properties and the wheels would come off. I think it could work (haven't tried) if you added KO computeds that read and wrote the backingStore properties ... but they'd have to have different, non-conflicting names, right?

Let's go back to root causes for a moment. What is too slow about using the ko model library and what are you doing that is faster? I'm having trouble imagining how the definition of the KO properties could be a performance issue. How have you measured the speed difference? What were the speed differences?

Also, did you try defining the KO properties in your own entity type constructor and registering that constructor with the MetadataStore as described in "Extending entities"?