码迷,mamicode.com
首页 > 编程语言 > 详细

Spring.Net

时间:2015-01-07 00:27:51      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</sectionGroup>
</configSections>
<spring>
<context>
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<description>An example that demonstrates simple IoC features.</description>

<object name="UserInfoBLL" type="SpringNet.UserInfoBLL, SpringNet">
<constructor-arg index="0" value="男"/>
<property name="Name" value="张三"/>
<property name="Per" ref="refPerson"/>
</object>

<object name="refPerson" type="SpringNet.Person, SpringNet">
<property name="Age" value="16"/>
</object>

</objects>
</spring>
</configuration>

 

private void button1_Click(object sender, EventArgs e)
{
//先把三个核心文件跟一个Logging文件复制到Lib文件夹下,然后添加引用,根据帮助文档修改配置文件
IApplicationContext ctx = ContextRegistry.GetContext();
IUserInfoBLL userInfo = (IUserInfoBLL)ctx.GetObject("UserInfoBLL");
MessageBox.Show(userInfo.ShowMsg("你好"));
}

Spring.Net

标签:

原文地址:http://www.cnblogs.com/bidianqing/p/4207362.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!