ORM: 开发自己的Data Access Application Block - Part I
2008-12-06 10:15:45 来源:WEB开发网DataAccessConfigurationSection
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Data;
namespace Artech.ApplicationBlock.Configuration
{
public class DataAccessConfigurationSection: ConfigurationSection
{
[ConfigurationProperty("", IsDefaultCollection = true)]
public DataAccessConfigurationCollection Databases
{
get
{
return this[""] as DataAccessConfigurationCollection;
}
set
{
this[""] = value;
}
}
}
}
我们可以把我们定义的Configure通过下面的方式运用到configuration文件中。
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="Artech.ApplicationBlock" type="Artech.ApplicationBlock.Configuration.ApplicationBlockConfigurationSectionGroup, Artech.ApplicationBlock.Configuration">
<section name="Artech.ApplicationBlock.DataAccess" type="Artech.ApplicationBlock.Configuration.DataAccessConfigurationSection,Artech.ApplicationBlock.Configuration"/>
<section name="Artech.ApplicationBlock.Messaging" type="Artech.ApplicationBlock.Configuration.MessagingConfigurationSection,Artech.ApplicationBlock.Configuration"/>
</sectionGroup>
</configSections>
<Artech.ApplicationBlock>
<Artech.ApplicationBlock.DataAccess>
<add name="sqlDatabase" connectionString="Data Source=JIANGJINNANSQLEXPRESS;Initial Catalog=iFramework;Integrated Security=True" ></add>
</Artech.ApplicationBlock.DataAccess>
</Artech.ApplicationBlock>
</configuration>
- ››开发Android 日历教程
- ››开发学院总结 Win 8实用技巧大全
- ››开发学院原创教程:把win8的IE10放桌面上方法(非...
- ››开发者眼中的Windows Phone和Android
- ››开发学院教你用SQL 语句最快速清空MySQL 数据表的...
- ››自己动手写iPhone wap浏览器之界面架构篇
- ››自己也能DIY个性真人QQ表情
- ››自己动手!巧法让酷狗动感歌词更完美
- ››自己编译Google Android内核的Linux源码
- ››自己写的一个jquery模板引擎(json比较好用)
- ››开发一个自己的HTML在线编辑器(一)
- ››开发一个自己的HTML在线编辑器(二)
更多精彩
赞助商链接