public static void RegisterDecorator <TServiceType>(IServiceDecorator <TServiceType> decorator) where TServiceType : class, IService { if (decorator == null) { throw new System.ArgumentNullException("decorator"); } if (!(decorator is TServiceType)) { throw new System.ArgumentException(string.Format("Decorator must implement the service type it is decorating: {0}.", typeof(TServiceType).Name)); } var inst = Services.Get <TServiceType>(); if (inst == null) { throw new System.InvalidOperationException(string.Format("Must create a concreate service of type {0} before decorating it.", typeof(TServiceType).Name)); } Entry <TServiceType> .Instance = decorator as TServiceType; ReplaceReferences(inst, decorator); decorator.Consume(inst); }
public static void AddDefaultFilters(IServiceDecorator serviceDecorator) { serviceDecorator.AddFilter <NetworkConnectionServiceFilter>(); }
public ContactService(IConnectionService connectionService, IServiceDecorator serviceDecorator) : base(connectionService, serviceDecorator) { _contactService = RestService.For <IContact>(ConnectionService._lazyHttpClient.Value, new RefitSettings(new NewtonsoftJsonContentSerializer())); }
protected BaseService(IConnectionService connectionService, IServiceDecorator serviceDecorator) { ConnectionService = connectionService; ServiceDecorator = serviceDecorator; }