Skip to content
Michael Herzog edited this page Aug 25, 2014 · 1 revision

Code Shortcuts for Developers

SmartStore.Services.ICommonServices

Contains frequently used common services in form of properties. Instead of defining multiple common services in the constructor of a dependant 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 }}, 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 depenency 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 depenency class, it'll also be injected automatically by Autofac.

Clone this wiki locally