Spring.NET 配置
2010-09-30 10:28
197 查看
创建内部类对象
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
通过工厂类的静态方法创建对象
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
通过工厂类对象的方法创建对象
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
普通注射
构造方法注射
属性引用其他对象
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
或者
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
Inline对象
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
注射容器
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
引用对象的属性
static属性
<objectid="exampleObject"type="Examples.ExampleObject+Person,ExamplesLibrary"/>
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
通过工厂类的静态方法创建对象
<objectid="exampleObject" type="Examples.ExampleObjectFactory,ExamplesLibrary" factory-method="CreateInstance"/>
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
通过工厂类对象的方法创建对象
<objectid="exampleFactory"type="..."></object> <objectid="exampleObject" factory-method="CreateInstance" factory-object="exampleFactory"/>
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
普通注射
<objectid="myConnection"type="System.Data.SqlClient.SqlConnection"> <property name="ConnectionString" value="IntegratedSecurity=SSPI;database=northwind;server=mySQLServer"/> </object>
构造方法注射
<objectname="exampleObject"type="SimpleApp.ExampleObject,SimpleApp">
<constructor-argname="years"value="7500000"/>
<constructor-argname="ultimateAnswer"value="42"/>
</object>
属性引用其他对象
<objectid="theTargetObject"type="..."></object>
<objectid="theClientObject"type="...">
<propertyname="targetName">
<idrefobject="theTargetObject"/>
</property>
</object>
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
或者
<objectid="theTargetObject"type="...">
...
</object>
<objectid="theClientObject"type="...">
<propertyname="targetName"value="theTargetObject"/>
</object>
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
Inline对象
<objectid="outer"type="...">
<propertyname="target">
<objecttype="ExampleApp.Person,ExampleApp">
<propertyname="name"value="Tony"/>
<propertyname="age"value="51"/>
</object>
</property>
</object>
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
注射容器
<objectid="moreComplexObject"type="Example.ComplexObject">
<!--
resultsinacalltothesetteroftheSomeList(System.Collections.IList)property
-->
<propertyname="SomeList">
<list>
<value>alistelementfollowedbyareference</value>
<refobject="myConnection"/>
</list>
</property>
<!--
resultsinacalltothesetteroftheSomeDictionary(System.Collections.IDictionary)property
-->
<propertyname="SomeDictionary">
<dictionary>
<entrykey="astring=>stringentry"value="justsomestring"/>
<entrykey-ref="myKeyObject"value-ref="myConnection"/>
</dictionary>
</property>
<!--
resultsinacalltothesetteroftheSomeNameValue(System.Collections.NameValueCollection)property
-->
<propertyname="SomeNameValue">
<name-values>
<addkey="HarryPotter"value="Themagicproperty"/>
<addkey="JerrySeinfeld"value="Thefunny(toAmericans)property"/>
</name-values>
</property>
<!--
resultsinacalltothesetteroftheSomeSet(Spring.Collections.ISet)property
-->
<propertyname="someSet">
<set>
<value>justsomestring</value>
<refobject="myConnection"/>
</set>
</property>
</object>
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
引用对象的属性
<objectname="person"type="Spring.Objects.TestObject,Spring.Core.Tests">
<propertyname="age"value="20"/>
<propertyname="spouse">
<objecttype="Spring.Objects.TestObject,Spring.Core.Tests">
<propertyname="age"value="21"/>
</object>
</property>
</object>
//willresultin21,whichisthevalueofproperty'spouse.age'ofobject'person'
<objectname="theAge"type="Spring.Objects.Factory.Config.PropertyRetrievingFactoryObject,Spring.Core">
<propertyname="TargetObject"ref="person"/>
<propertyname="TargetProperty"value="spouse.age"/>
</object>
static属性
<objectid="currentUICulture"
type="Spring.Objects.Factory.Config.PropertyRetrievingFactoryObject,Spring.Core">
<propertyname="StaticProperty">
<value>System.Globalization.CultureInfo.CurrentUICulture,Mscorlib</value>
</property>
</object>
相关文章推荐
- ASP.NET MVC4 中整合 NHibernate3.3、Spring.NET2.0、ExtJS4 笔记三:NHibernate配置
- net的app.config程序配置Spring.net和nhibernate
- 在Spring.Net中利用NHibernate配置增加二级缓存
- Spring.NET环境搭建和基本API及XML配置笔记整理
- Spring.net依赖注入及环境配置
- Spring.NET使用assembly方式设置配置文件
- Castle与Spring.Net在用法和配置上的区别
- 搭建你的Spring.Net+Nhibernate+Asp.Net Mvc 框架 (四)配置全攻略(转)
- WinForm下的Nhibernate+Spring.Net的框架配置文件
- spring.net泛型的配置以及使用方法
- spring.net config/file/assembly 配置说明
- Spring.NET教程(十三)——AOP的配置(基础篇)
- Spring中Quartz的配置 本文引自:SQL吧|企业网站源码下载(www.sql8.net) 原文参考:http://www.sql8.net/a/course/chengxu/java/spr
- spring.net 配置:获取对象
- Spring.NET 中配置 ashx 的映射,以及其它各种映射的处理
- Spring.net 控制反转(IOC)依赖注入(DI)的使用 以及Config文件的配置
- spring cloud+dotnet core搭建微服务架构:配置中心
- ASP.NET MVC 1.0 + spring.net 1.2.0.20288 + NHibernate 2.0.1.4000整合笔记(二)——spring.net配置
- Castle IOC容器与Spring.NET配置之比较
- [Spring.NET IoC] 之二:配置文件