Re: [Modeling-users] one model, multiple database instances
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2004-08-10 05:47:38
|
Hi, Delio Brignoli <in...@dr...> wrote: > Hello, >=20 > I'm evaluating the use of modeling for our new project(s) and was > wondering if some of you could give me pointers on how to access > multiple database instances of the same model in the same > application. (I understand that each database instance will be > isolated and don't expect to insert object from an objectStore into > another) After creating my first model definition and 30 minutes dive > in the docs, it seems I'll have to create an EC passing a 'properly > crafted' :-) ObjectStore instance. Am I on the right track? Without more details, I guess you intend to do some load-balancing between = db-instances in aread-only app., right? First, if you want to do that in different processes, simply change the model's connection dictionary before using it; each process will then use its own db instance. Regarding EC(parentObjectStore): it's usually used to make child ECs; passing it a dedicated ObjectStore is completely untested. But you're on the right track: you can either give it a dedicated DBContext, or use the default behaviour (which assigns a ObjectStoreCoordinator) and design your own ObjStoreCoord. so that e.g. it returns different DBContexts for different ECs. In both cases, you'll have to take care of the DBContext's Database (see e.g. DBContext.handleNotification): either each one gets its own, or they all share the same. If every DBContext gets its own Database object, then each EC should *always* get the same DBContext, or you'll defeat the snapshotting ref. counting. -- S=E9bastien. |