摘要: _logger.LogInformation("你访问了首页"); _logger.LogWarning("警告信息"); _logger.LogError("错误信息"); 使用DI 直接可以使用对象。 日志级别:Trace -》Debug-》 Information -》Warning-》 Er 阅读全文
posted @ 2020-06-16 14:19 Aaron_Net 阅读(621) 评论(0) 推荐(0) 编辑
摘要: Netcore内置IOC容器,services.AddSingleton<>, 就是往内置IOC容器里配置一个单例,将接口跟实现映射在一起, 以后每次使用构造函数注入这个IProductRepository接口,都会获得这个单例对象! 不需要new ProductRepository() DI -- 阅读全文
posted @ 2020-06-16 11:29 Aaron_Net 阅读(1034) 评论(0) 推荐(1) 编辑