摘要: 首先谈一下IServiceProvider IServiceProvider只提供给了一个根据类型获取对象的功能,试想一下IOC总得有一个找到对象,具体如下 public interface IServiceProvider { object GetService(Type serviceType) 阅读全文
posted @ 2020-03-21 21:57 李志章 阅读(1136) 评论(0) 推荐(0) 编辑
摘要: 首先谈一下IServiceCollection IServiceCollection是一个接口,它继承4个父接口,而且是和ServiceDescriptor挂钩,也就是说,它是保存ServiceDescriptor的一个数据结构接口,具体定义如下: public interface IService 阅读全文
posted @ 2020-03-21 20:03 李志章 阅读(864) 评论(0) 推荐(0) 编辑
摘要: ServiceDescriptor在.net core中的作用就是DI中注入服务元素的描述。每一个元素核心内容部分包括需要注入的服务元素的类型ServiceType,它对应的接口(如果有的话)ImplementationType,以及服务元素的生命周期ServiceLifetime。 源码中Serv 阅读全文
posted @ 2020-03-21 19:27 李志章 阅读(1444) 评论(0) 推荐(0) 编辑