angularjs - Angular and Breeze multiple EntityManagers -


my angular application uses breeze , encapsulates breeze calls within datacontext service. how can use service different entitymanagers? thinking need abandon using datacontext angular service in situation, since seems going require maintaining state.

how others deal this? hate not being able use angular service, want have re-use of datacontext different entitymanager.

i don't know enough requirements give specific answer. wouldn't quick abandon "datacontext" abstraction.

this question appears related other question here seems "sandbox" case. i'll pick thread there.

sometimes need multiple entitymanagers when need talk multiple services, each own entity model. , when happens typically have different workflow each service in case should have separate "datacontexts" each workflow. problem "solved" :-)

sometimes i'll want 2 entitymanagers same service because i'm "sandboxing". "sandbox" when need 2 copies of same nominal entity:

  1. a read-only version representing state of entity on database
  2. a mutable version holding user's unsaved changes.

i might implement scenario separate "datacontexts" too

  1. the main, read-only datacontext handling of app's data access needs.
  2. an "editing" datacontext, smaller first, focused on edit/save workflow.

each datacontext has own instance of entitymanager. each instance configured same way , typically has same metadata.

i might create sandboxcontextfactory service create new instances of specialized datacontext. each such sandboxcontext has own entitymanager.

i tend write entitymanagerprovider (emp) service create entitymanagers , inject datacontext services. emp can create , coordinate multiple instances of commonly configured "master" entitymanager.

the emp might:

  • create "master" entitymanager @ start.
  • populate "master" metadata (via fetchmetadata call)
  • populate "master" app-wide reference entities (e.g., "lookup" entities).
  • create new "sandbox" managers when asked, perhaps by.
    • cloning master: var childem = masterem.createemptycopy();
    • populating child common data master (e.g., reference entities). can exporting pertinent entities master , importing them child.

hope these architectural speculations inspire solution appropriate you. if need developing application along these lines, might consider engaging ideablade's professional services.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -