public static THandler GetHandler <THandler>(this ServiceScope factory) { THandler handler; try { handler = factory.GetInstance <THandler>(); } catch (Exception e) { throw new InvalidOperationException(typeof(THandler).ToString(), e); } if (handler == null) { throw new InvalidOperationException(typeof(THandler).ToString()); } return(handler); }
public BusAsync(ServiceScope serviceFactory) { _logger = serviceFactory.GetInstance <ILogger <BusAsync> >(); this._serviceFactory = serviceFactory ?? throw new ArgumentNullException(nameof(serviceFactory)); }