That's what I'm already doing, but if I access that repository (I use the term Service Locator) from an IStartable component, there is no guarantee that the repository will have the service I want.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ayende Rahien
Sent: Tuesday, July 18, 2006 3:38 PM
To: castleproject-users@lists.sourceforge.net
Subject: Re: [Castle-users] Static dependencies [was Re: Startable facility]

I use a static Repository<T> that request the Repository<MyDomainObject> from Windsor.
In general, you just pull it out of a central location, you don't need to worry about it, since it is guaranteed to be initialized when you access it.

On 7/18/06, Shawn Hinsey <[EMAIL PROTECTED]> wrote:


One of the reasons I ended up adopting a Service Locator pattern to
reference DAO objects was that I used them in static scenarios.

For example:

DomainObject[] objects = DomainObject.LoadAll();

Foreach(DomainObject item in objects)
{
        item.Property = "NewValue";
        item.Save();
}

DomainObject defines a private property of type IDomainObjectDao which
does the service location and snags the correct implementation.

How do I best do this so that the services that my startable executive
class starts can use the domain objects safely?

Sorry if I am being obtuse about this - the whole startable doesn't have
access to the whole configuration graph thing kind of threw me. It makes
sense to me now, but I'm having trouble figuring out how to adapt my
architecture.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
CastleProject-users mailing list
CastleProject-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/castleproject-users

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
CastleProject-users mailing list
CastleProject-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/castleproject-users

Reply via email to