Andre Loker
unread,May 6, 2008, 3:11:24 PM5/6/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Castle Project Users
Hi,
I am looking for the best way to get access to some of the MonoRail
services. For example I need access to IEmailTemplateService and
IEmailSender outside of a Controller.
Preferably I'd like them to be injected as dependencies automatically
(I use Windsor integration), however they do not seem to be registered
as components.
So, what I do now is this:
//..........
public class SomeComponent: ISomeService {
public IEmailTemplateService Templates { get; set; }
public IEmailSender Sender { get; set; }
public SomeComponent() {
// wire up the dependencies manually :-(
var services =
MonoRailHttpHandlerFactory.CurrentEngineContext.Services;
Templates = services.EmailTemplateService;
Sender = services.EmailSender;
}
...
// .........
(In this case, SomeComponent is registered as a component in Windsor,
so automatic dependency injection of Templates and Sender would have
been nice)
My questions are:
1. Is there a way to have common monorail services like
IEmailTemplateService and IEmailSender be injected into components by
Windsor?
2. Is MonoRailHttpHandlerFactory the recommended starting point to
access the current engine context and its services?
3. How do I access the IMonoRailContainer? The
MonoRailHttpHandlerFactory.Container is not static (although the
backing field is).
Regards,
Andre