コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: BusAsync.cs プロジェクト: digify-ge/Digify.Micro
 public BusAsync(ServiceScope serviceFactory)
 {
     _logger = serviceFactory.GetInstance <ILogger <BusAsync> >();
     this._serviceFactory = serviceFactory ?? throw new ArgumentNullException(nameof(serviceFactory));
 }