From 3da545bf39d8fb07ac6c6f0e0a698e2a113be0b6 Mon Sep 17 00:00:00 2001 From: Yaoyuan Date: Mon, 31 Aug 2020 20:41:09 +0800 Subject: [PATCH] sepearte files --- src/IoC/IoC/Container.cs | 26 ++++++++++++++++ src/IoC/IoC/IoC.csproj | 5 +++- src/IoC/IoC/Program.cs | 49 +++++++------------------------ src/IoC/IoC/implement/Aunt.cs | 16 ++++++++++ src/IoC/IoC/inerface/ISwapable.cs | 16 ++++++++++ 5 files changed, 73 insertions(+), 39 deletions(-) create mode 100644 src/IoC/IoC/Container.cs create mode 100644 src/IoC/IoC/implement/Aunt.cs create mode 100644 src/IoC/IoC/inerface/ISwapable.cs diff --git a/src/IoC/IoC/Container.cs b/src/IoC/IoC/Container.cs new file mode 100644 index 0000000..118add0 --- /dev/null +++ b/src/IoC/IoC/Container.cs @@ -0,0 +1,26 @@ +using Autofac; +using IoC.implement; +using IoC.inerface; + +namespace IoC +{ + public class Container + { + /// + /// 仲介公司 + /// + /// + public static IContainer MiddleCompany() + { + ContainerBuilder builder = new ContainerBuilder(); + + //在仲介公司裡寫需求人申請單 + builder.RegisterType(); + //小明所需打掃阿姨需求 + builder.RegisterType().As(); + + return builder.Build(); + } + + } +} diff --git a/src/IoC/IoC/IoC.csproj b/src/IoC/IoC/IoC.csproj index b6eb4ed..2c6e46f 100644 --- a/src/IoC/IoC/IoC.csproj +++ b/src/IoC/IoC/IoC.csproj @@ -37,7 +37,6 @@ ..\packages\Autofac.4.6.2\lib\net45\Autofac.dll - True @@ -52,6 +51,9 @@ + + + @@ -59,6 +61,7 @@ +