using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
namespace ETD.Data
{
///
/// 获取数据库配置
///
public class Config
{
///
/// 获取数据配置节ETD.Data
/// 检索当前应用程序默认配置的指定配置节
///
private static Dictionary dbpList = ConfigurationManager.GetSection("ETD.Data") as Dictionary;
///
/// 获取数据库连接配置
///
///
///
public static DatabaseProperty GetDatabaseProperty(string name)
{
if (!dbpList.ContainsKey(name))
{
throw new Exception("系统找不到数据库配置");
}
return dbpList[name];
}
///
/// 获取系统数据库默认配置
///
public static DatabaseProperty DefaultDatabaseProperty
{
get
{
if (dbpList.ContainsKey("Default"))
{
return dbpList["Default"];
}
else
{
throw new Exception("系统找不到数据库配置!");
}
}
}
}
}