using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Text;
namespace DocTools.Dtos
{
///
/// 数据库Dto
///
public class DBDto
{
public DBDto() { }
public DBDto(string dbName, object tag = null)
{
this.DBName = dbName;
this.Tag = tag;
}
///
/// 数据库名称
///
public string DBName { get; set; }
///
/// 数据库类型
///
public string DBType { get; set; }
private List _Tables = null;
///
/// 表结构信息
///
public List Tables
{
get
{
if (_Tables == null)
{
return new List();
}
else
{
_Tables.ForEach(t =>
{
t.Comment = FilterIllegalDir(t.Comment);
});
return _Tables;
}
}
set
{
_Tables = value;
}
}
///
/// 数据库视图
///
public Dictionary Views { get; set; }
///
/// 数据库存储过程
///
public Dictionary Procs { get; set; }
///
/// 其他一些参数数据,用法如 winform 控件的 Tag属性
///
public object Tag { get; set; }
///
/// 处理非法字符路径
///
///
///
private string FilterIllegalDir(string str)
{
if (str.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
{
str = string.Join(" ", str.Split(Path.GetInvalidFileNameChars()));
}
return str;
}
}
}