Пример #1
0
        /// <summary>
        /// 创建指定服务对象
        /// </summary>
        /// <typeparam name="T">服务类型</typeparam>
        /// <returns></returns>
        public T CreateService <T>()
        {
            var type = typeof(T);

            if (!ServiceBindings.ContainsKey(type))
            {
                return(default(T));
            }

            type = ServiceBindings[type] as Type;

            if (type == null)
            {
                return(default(T));
            }

            return((T)Activator.CreateInstance(type));
        }