• 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: best practice?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: best practice?


  • Subject: Re: best practice?
  • From: Guido Neitzer <email@hidden>
  • Date: Sun, 5 Oct 2008 10:13:14 -0600

On 05.10.2008, at 08:36, WebObjects wrote:

Hello, I was wondering, what is the best way to do the login of a user into the system.
to keep track of the username and password on the Session, or somewhere else?

We store the user object in a the session ivar and push it to the ERXThreadStorage in session.awake(), so it's available everywhere we need it.


also I was reading this info : http://wiki.objectstyle.org/confluence/display/WONDER/Using+a+custom+EOEditingContext+(ERXEC)+Subclass trying to follow the advice of some people, to do not use the session().defaultEditingContext; so the only thing I should do is that what is says there?

Ah, no. These are two different things.

The editing context you get from session().defaultEditingContext() is just a normal editing context where the session conveniently takes care of locking and unlocking it. Nevertheless it is a central thing you might not want to use for everything.

If you want to get a separate editing context, you just do:#

EOEditingContext editingContext = ERXEC.newEditingContext();

This will give you a new peer editing context. If you use ERXEC autolocking (and you should, check the example Properties in ERExtensions), this editing context will get locked and unlocked for you.

Now you can look at editing contexts as "sandboxes" to work with objects in this editing context without affecting other parts of the application.

You can create editingContext subclasses if you want specific behaviour, but I never had the need to create one.

cug


-- Real World WebObjects Bootcamp at the Big Nerd Ranch: http://www.bignerdranch.com/classes/real-world_webobjects.shtml

_______________________________________________
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: 
 >best practice? (From: WebObjects <email@hidden>)

  • Prev by Date: Re: Obtain primary key early?
  • Next by Date: Rapid Turnaround mode not working
  • Previous by thread: best practice?
  • Next by thread: Rapid Turnaround mode not working
  • Index(es):
    • Date
    • Thread