WEB开发网
开发学院数据库MSSQL Server ORM: 开发自己的Data Access Application Block -... 阅读

ORM: 开发自己的Data Access Application Block - Part I

 2008-12-06 10:15:45 来源:WEB开发网   
核心提示: DataAccessConfigurationSectionusing System;using System.Collections.Generic;using System.Text;using System.Configuration;using System.Data;namesp

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>

上一页  5 6 7 8 9 10 

Tags:ORM 开发 自己

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接