一、开发环境
系统:Win10
编译器:VS2013
.net版本:.net framework4.5
二、涉及程序集
Spring.Core.dll 1.3.1
Common.Loggin.dll
三、开发过程
1.项目结构
2.编写Person.cs
namespace SpringNetSetDi{ public class Person { public string RealName { get; set; } public string NickName { get; set; } public string LoginName { get; set; } public string ShowName { get; set; } }}
3.编写Animal.cs
namespace SpringNetSetDi{ public class Animal { public string Name { get; set; } public IList TypeList { get; set; } }}
4.编写Zoo.cs
namespace SpringNetSetDi{ public class Zoo { public ListAnimalList { get; set; } }}
5.编写WebSetting.cs
namespace SpringNetSetDi{ public class WebSetting { public IDictionaryPrintSetting { get; set; } }}
6.配置文件App.config
7.控制台代码
namespace SpringNetSetDi{ class Program { static void Main(string[] args) { IApplicationContext context = ContextRegistry.GetContext(); Person person = context.GetObject("person") as Person; Animal animal = context.GetObject("animal") as Animal; Zoo zoo = context.GetObject("zoo") as Zoo; Console.ReadKey(); } }}
四、说明
这边有个坑,花了我好长时间,具体解决看