Created
November 5, 2019 06:18
-
-
Save SunXiaoShan/95afc33f63a34ba9268798d33201fd08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static IContainer MiddleCompany() | |
{ | |
ContainerBuilder builder = new ContainerBuilder(); | |
//在仲介公司裡寫需求人申請單 | |
builder.RegisterType<MineWithMiddle>(); | |
//小明所需打掃阿姨需求 | |
builder.RegisterType<Aunt>().As<ISwapable>(); | |
return builder.Build(); | |
} | |
IContainer middleCompany = MiddleCompany(); | |
//仲介公司(IOC AutoFac)自動幫小明注入一個打掃阿姨 | |
MineWithMiddle mineWithMiddle = middleCompany.Resolve<MineWithMiddle>(); | |
mineWithMiddle.Room(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment