Documentation for SmartStore.NET 2.5
Developer Shortcuts
Code Shortcuts for Developers
SmartStore.Services.ICommonServices
Contains frequently used common services in the form of properties. Instead of defining multiple common services in the constructor of a dependent type, you just define one single dependency, {{ICommonServices}}, which provides the following properties:
- Cache
- DbContext
- StoreContext
- WebHelper
- WorkContext
- EventPublisher
- Localization
- Notifier
- Permissions
- CustomerActivity
* All services are internally wrapped in {{ Lazy<TService> }}, so none of the services get instantiated until first hit.
T (Localizer)
If there is a property named {{T}} of the type {{Localizer}} within a dependency class, it'll be injected automatically by Autofac. So, instead of writing {{_localizationService.GetResource("xyz")}} you just type {{T("xyz")}}.
Logger
If there is a property of type {{ILogger}} (with whatever name) within a dependency class, it'll also be injected automatically by Autofac.