Пример #1
0
 private T GetDependency <T>(Type type)
 {
     using (InjectionContext.NewContext())
     {
         return(default(T));
     }
 }
Пример #2
0
        private T GetDependency <T>(string name)
        {
            using (InjectionContext.NewContext())
            {
                InjectionProvider provider;
                if (this.namedProviderMap.TryGetValue(name, out provider))
                {
                    return(provider.GetInstance(this));
                }

                throw new InvalidOperationException($"No dependency with name '{name}' defined.");
            }
        }