示例#1
0
文件: Ioc.cs 项目: yplonggit/Util
 /// <summary>
 /// 创建实例
 /// </summary>
 /// <typeparam name="T">实例类型</typeparam>
 public static T Create <T>()
 {
     return(Container.Create <T>());
 }
示例#2
0
 /// <summary>
 /// 释放容器
 /// </summary>
 public static void Dispose()
 {
     Container.Dispose();
 }
示例#3
0
 /// <summary>
 /// 注册依赖
 /// </summary>
 /// <param name="configs">依赖配置</param>
 public static void Register(params IConfig[] configs)
 {
     Container.Register(null, null, configs);
 }
示例#4
0
 /// <summary>
 /// 注册依赖
 /// </summary>
 /// <param name="services">服务集合</param>
 /// <param name="configs">依赖配置</param>
 public static IServiceProvider Register(IServiceCollection services, params IConfig[] configs)
 {
     return(Container.Register(services, null, configs));
 }
示例#5
0
 /// <summary>
 /// 创建对象
 /// </summary>
 /// <param name="type">对象类型</param>
 public static object Create(Type type)
 {
     return(Container.Create(type));
 }