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:
- a read-only version representing state of entity on database
- a mutable version holding user's unsaved changes.
i might implement scenario separate "datacontexts" too
- the main, read-only datacontext handling of app's data access needs.
- 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 entitymanager
s , 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.
hope these architectural speculations inspire solution appropriate you. if need developing application along these lines, might consider engaging ideablade's professional services.
Comments
Post a Comment