Exemple #1
0
        public T GetInstance <T>() where T : class
        {
            Type interfaceType             = typeof(T);
            InterfaceImplementer implement = null;

            if (!_data.TryGetValue(interfaceType, out implement))
            {
                throw new InvalidOperationException("不存在接口" + interfaceType.FullName + "的实现,无法获取实例");
            }
            return(implement.GetInstance <T>());
        }
        public T GetInstance <T>() where T : class
        {
            Type interfaceType             = typeof(T);
            InterfaceImplementer implement = null;

            if (!_data.TryGetValue(interfaceType, out implement))
            {
                throw new InvalidOperationException(string.Format(Strings.NoInterfaceImpl, interfaceType.FullName));
            }
            return(implement.GetInstance <T>());
        }