On 7/18/06, Shawn Hinsey <[EMAIL PROTECTED]> wrote: > Ah, I don't pass the logger in via a constructor, it's coming from a > property in a base class that does a lookup in the container.
This is, well, strange... You're using an IoC container but not taking advantages from it, and while base classes have references to it, you're contaminating your API and creating a strong dependency on the container implementation... > This makes > sense for the logger, but I do that frequently, for example, my domain > objects (I'm not using Active Record, I use iBATIS) have private > properties that refer to their DAO objects, and those DAOs are obtained > from the container in the same way (i.e., > ApplicationContext.Current[typeof(IListingDao)] as IListingDao). Well, this is also strage, but I undertand that you want your models to have rich support for persistence operations. I'd use value objects and rely on that separated layer as it makes my code more natural. > Is > there any way I can satisfy these dependencies without requiring > constructor injection? For components, yes, many... But the scenario you depicted is non-components that wants to use certain container services (like logging), and then I'm afraid you'd have to use hacks or change your architecture to, for example, use custom factories that inject things on the model (just a random idea) > If there's no way to do this with the existing Startable facility, is > there a hook that I could use to write my own that would fire all of the > Start methods after the container had completed its external > configuration? I realize that is a little sketchy given that you can > programmatically configure the container. Just extend the WindsorContainer class, create your own constructor and put your code after running the installer. -- Cheers, hammett http://hammett.castleproject.org/ ------------------------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/castleproject-users
