ASP.NET Core中使用Unity5
2021-01-14 18:17
标签:set 技术 sys gif ade resolve gen word new
⒈添加相关依赖 ⒉扫描项目接口实现类 ⒊代码中注入 ASP.NET Core中使用Unity5 标签:set 技术 sys gif ade resolve gen word new 原文地址:https://www.cnblogs.com/lonelyxmas/p/12940785.htmlInstall-Package Unity
Install-Package Unity.RegistrationByConvention
1 using System;
2 using System.Linq;
3 using Unity;
4 using Unity.RegistrationByConvention;
5
6 namespace Unity_Test.Unity
7 {
8 public class UnityConfig
9 {
10 private static Lazy
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using Unity;
5
6 namespace Unity_Test
7 {
8 public class Test
9 {
10 [Dependency]
11 public IService service { get; set; }
12 public void sysout()
13 {
14 service.sayHello();
15 Console.ReadKey();
16 }
17 }
18 }
文章标题:ASP.NET Core中使用Unity5
文章链接:http://soscw.com/index.php/essay/41900.html