Class to import Services.Notifier?

Topics: Writing modules
Nov 11, 2011 at 3:24 PM
Which Class I need to import?
Services.Notifier.Information(T("Thank you for your message."));
Nov 11, 2011 at 3:41 PM

IOrchardServices (to get Services). To get 'T' (which is a Localizer) you use a slightly different method. It should all look like this;

public class MyClass : ISomeDependency {
    public MyClass(IOrchardServices services) {
        Services = services;
        T = NullLocalizer.Instance;
    }
    public Localizer T { get; set; }
    public IOrchardServices Services { get; set; }
}

Note that IOrchardServices is also public, whereas the convention for most imports is: private readonly IDependency _dependency;

This is just following the convention in Orchard's core modules, and as far as I know it's only relevant for testing purposes, but I follow it anyway.