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<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 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.



Last edited Apr 8, 2014 at 5:38 PM by muratcakir, version 4