• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Different connections to aDatabase
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Different connections to aDatabase


  • Subject: Re: Different connections to aDatabase
  • From: Ken Anderson <email@hidden>
  • Date: Wed, 12 Oct 2005 10:39:04 -0400

I would either create different instances pointing at a different database for each school (and therefore a different URL), or modify the existing data model to handle multiple schools and have the user login (and always restrict access by school).

On the restriction idea, a cool thing to do is to subclass EOEditingContext, override objectsWithFetchSpecification, and introduce a restricting qualifier into every query that could use one. I often put an entry into the userInfo of an entity specifying the path to the constraint so that the added qualifier only gets introduced when necessary (when the userInfo has that key).

As an example, on a Student entity, you could add a userInfo & value:

SchoolPath    school

Or, more complicated, if you do a query on a join table between student and class (StudentClass), you could have:

SchoolPath    student.school

You could keep the current school in the user's session, and create editing contexts that store that school. Then, whenever the SchoolPath existed in the userInfo for an entity being queried, you could just add the keypath and the value.

Of course, if you do raw sql or anything out of the ordinary, this may not work.

Ken

On Oct 12, 2005, at 9:11 AM, Mark Morris wrote:

Hello Frank,

Assuming you need a database connection to authenticate the users and to determine which school to use, a simple approach would be to have 2 EOModels, one for authentication and one for everything else. After login, you can change the connection dictionary for the second model based on the user. (There's a setConnectionDictionary method on the EOModel object.)

Hope this helps.  :-)

Regards,
Mark

On Oct 12, 2005, at 2:53 AM, Frank Stock wrote:


Hi,

I have a few projects we use in our school. I would like other schools to use the same projects.
We use Frontbase as our local database, so I would like to make new users in the database (one for each school).
Is it possible to control at login and connect to the school you want in your application?



Thanks, Frank Stock Sint-Pieterscollege

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40onpointsoftware.com


This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Different connections to aDatabase (From: Frank Stock <email@hidden>)
 >Re: Different connections to aDatabase (From: Mark Morris <email@hidden>)

  • Prev by Date: Re: Different connections to aDatabase
  • Next by Date: Re: Wonder & CVS
  • Previous by thread: Re: Different connections to aDatabase
  • Next by thread: Re: Different connections to aDatabase
  • Index(es):
    • Date
    • Thread