/// <summary> /// 创建数据库 /// <param name="useDb">使用这个数据库创建本数据库</param> /// <param name="filePath">将本数据库创建到磁盘的路径</param> /// </summary> public void Create(RdbDescriptor useDb, string filePath = null) { using (var conn = useDb.GetConnection()) { var cmd = conn.CreateCommand(); var config = string.Empty; if (!string.IsNullOrEmpty(filePath)) { if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } var fileName = Path.Combine(filePath, Database.CatalogName + ".mdf"); config = @" ON PRIMARY ( NAME = N'" + Database.CatalogName + @"', FILENAME = N'" + fileName + "')"; } cmd.CommandText = @"if DB_ID('" + Database.CatalogName + "') IS NULL CREATE DATABASE " + Database.CatalogName + config; cmd.CommandType = CommandType.Text; if (conn.State != ConnectionState.Open) { conn.Open(); } cmd.ExecuteNonQuery(); } }
private static DbParameter CreateParameter(RdbDescriptor db, string parameterName, object value, DbType dbType) { var p = db.CreateParameter(); p.ParameterName = parameterName; p.Value = value; p.DbType = dbType; return(p); }
public string GetViewDefinition(RdbDescriptor db, DbView view) { const string sql = "sp_helptext"; var sb = new StringBuilder(); using (var reader = db.ExecuteReader(sql, CommandType.StoredProcedure, CreateParameter(db, "objname", view.Name, DbType.String))) { while (reader.Read()) { sb.Append(reader.GetString(reader.GetOrdinal("Text"))); } } return(sb.ToString()); }
/// <summary> /// /// </summary> /// <param name="db"></param> /// <returns></returns> public IList <DbViewColumn> GetViewColumns(RdbDescriptor db) { var sql = _acDomain.Config.SqlServerViewColumnsSelect; IList <DbViewColumn> list = new List <DbViewColumn>(); using (var reader = db.ExecuteReader(sql, null)) { while (reader.Read()) { list.Add(DbViewColumn.Create(db.Database.Id, reader)); } reader.Close(); return(list); } }
/// <summary> /// /// </summary> /// <param name="db"></param> /// <returns></returns> public IList <DbView> GetDbViews(RdbDescriptor db) { var queryString = _acDomain.Config.SqlServerViewsSelect; var views = new List <DbView>(); using (var reader = db.ExecuteReader(queryString, null)) { while (reader.Read()) { views.Add(new DbView(db.Database.Id, reader)); } reader.Close(); } return(views); }
/// <summary> /// /// </summary> /// <param name="db"></param> /// <returns></returns> public IList <DbTable> GetDbTables(RdbDescriptor db) { var sql = _acDomain.Config.SqlServerTablesSelect; var tables = new List <DbTable>(); using (var reader = db.ExecuteReader(sql, null)) { while (reader.Read()) { tables.Add(new DbTable(db.Database.Id, reader)); } reader.Close(); } return(tables); }
/// <summary> /// /// </summary> /// <param name="db"></param> /// <param name="sortField"></param> /// <param name="sortOrder"></param> /// <returns></returns> public IList <DbTableSpace> GetTableSpaces(RdbDescriptor db, string sortField, string sortOrder) { if (string.IsNullOrEmpty(sortField)) { sortField = "Rows"; } if (string.IsNullOrEmpty(sortOrder)) { sortOrder = "asc"; } Debug.Assert(sortOrder == "asc" || sortOrder == "desc"); string sql = @"CREATE TABLE #T ( Name VARCHAR(255) , [Rows] BIGINT , Reserved VARCHAR(20) , Data VARCHAR(20) , IndexSize VARCHAR(20) , UnUsed VARCHAR(20) ) EXEC SP_MSFOREACHTABLE ""INSERT INTO #T EXEC SP_SPACEUSED '?'"" SELECT * FROM #T ORDER BY " + sortField + " " + sortOrder + @" DROP TABLE #T"; var spaces = new List <DbTableSpace>(); using (var reader = db.ExecuteReader(sql, null)) { while (reader.Read()) { spaces.Add(DbTableSpace.Create(reader)); } reader.Close(); } return(spaces); }
/* * sys.sp_addextendedproperty @name = NULL, -- sysname * @value = NULL, -- sql_variant * @level0type = '', -- varchar(128) * @level0name = NULL, -- sysname * @level1type = '', -- varchar(128) * @level1name = NULL, -- sysname * @level2type = '', -- varchar(128) * @level2name = NULL -- sysname * * sys.sp_updateextendedproperty @name = NULL, -- sysname * @value = NULL, -- sql_variant * @level0type = '', -- varchar(128) * @level0name = NULL, -- sysname * @level1type = '', -- varchar(128) * @level1name = NULL, -- sysname * @level2type = '', -- varchar(128) * @level2name = NULL -- sysname * * sys.sp_dropextendedproperty @name = NULL, -- sysname * @level0type = '', -- varchar(128) * @level0name = NULL, -- sysname * @level1type = '', -- varchar(128) * @level1name = NULL, -- sysname * @level2type = '', -- varchar(128) * @level2name = NULL -- sysname */ /// <summary> /// /// </summary> /// <param name="db"></param> /// <param name="id"></param> /// <param name="description"></param> /// <param name="metaDataType"></param> public void CrudDescription(RdbDescriptor db, RDbMetaDataType metaDataType, string id, string description) { const string addProcName = "sys.sp_addextendedproperty"; const string updateProcName = "sys.sp_updateextendedproperty"; const string dropProcName = "sys.sp_dropextendedproperty"; const string propertyName = "MS_Description"; switch (metaDataType) { case RDbMetaDataType.Database: break; case RDbMetaDataType.Table: #region Table DbTable table; if (!db.TryGetDbTable(id, out table)) { throw new AnycmdException("意外的数据库表" + id); } if (description == null && table.Description != null) { db.ExecuteNonQuery(dropProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", table.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", table.Name, DbType.String)); } else if (table.Description == null) { db.ExecuteNonQuery(addProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", table.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", table.Name, DbType.String)); } else { db.ExecuteNonQuery(updateProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", table.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", table.Name, DbType.String)); } table.Description = description; #endregion break; case RDbMetaDataType.View: #region View DbView view; if (!db.TryGetDbView(id, out view)) { throw new AnycmdException("意外的数据库视图" + id); } if (description == null && view.Description != null) { db.ExecuteNonQuery(dropProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", view.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", view.Name, DbType.String)); } else if (view.Description == null) { db.ExecuteNonQuery(addProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", view.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", view.Name, DbType.String)); } else { db.ExecuteNonQuery(updateProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", view.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", view.Name, DbType.String)); } view.Description = description; #endregion break; case RDbMetaDataType.TableColumn: #region TableColumn DbTableColumn tableColumn; if (!db.AcDomain.Rdbs.DbTableColumns.TryGetDbTableColumn(db, id, out tableColumn)) { throw new AnycmdException("意外的数据库表列标识" + id); } if (description == null && tableColumn.Description != null) { db.ExecuteNonQuery(dropProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", tableColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", tableColumn.TableName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", tableColumn.Name, DbType.String)); } else if (tableColumn.Description == null) { db.ExecuteNonQuery(addProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", tableColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", tableColumn.TableName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", tableColumn.Name, DbType.String)); } else { db.ExecuteNonQuery(updateProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", tableColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", tableColumn.TableName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", tableColumn.Name, DbType.String)); } tableColumn.Description = description; #endregion break; case RDbMetaDataType.ViewColumn: #region ViewColumn DbViewColumn viewColumn; if (!db.AcDomain.Rdbs.DbViewColumns.TryGetDbViewColumn(db, id, out viewColumn)) { throw new AnycmdException("意外的数据库视图列标识" + id); } if (description == null && viewColumn.Description != null) { db.ExecuteNonQuery(dropProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", viewColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", viewColumn.ViewName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", viewColumn.Name, DbType.String)); } else if (viewColumn.Description == null) { db.ExecuteNonQuery(addProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", viewColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", viewColumn.ViewName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", viewColumn.Name, DbType.String)); } else { db.ExecuteNonQuery(updateProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", viewColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", viewColumn.ViewName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", viewColumn.Name, DbType.String)); } viewColumn.Description = description; #endregion break; default: break; } }
public string GetViewDefinition(RdbDescriptor db, DbView view) { const string sql = "sp_helptext"; var sb = new StringBuilder(); using (var reader = db.ExecuteReader(sql, CommandType.StoredProcedure, CreateParameter(db, "objname", view.Name, DbType.String))) { while (reader.Read()) { sb.Append(reader.GetString(reader.GetOrdinal("Text"))); } } return sb.ToString(); }
private static DbParameter CreateParameter(RdbDescriptor db, string parameterName, object value, DbType dbType) { var p = db.CreateParameter(); p.ParameterName = parameterName; p.Value = value; p.DbType = dbType; return p; }
/// <summary> /// /// </summary> /// <param name="db"></param> /// <returns></returns> public IList<DbViewColumn> GetViewColumns(RdbDescriptor db) { var sql = _acDomain.Config.SqlServerViewColumnsSelect; IList<DbViewColumn> list = new List<DbViewColumn>(); using (var reader = db.ExecuteReader(sql, null)) { while (reader.Read()) { list.Add(DbViewColumn.Create(db.Database.Id, reader)); } reader.Close(); return list; } }
/// <summary> /// /// </summary> /// <param name="db"></param> /// <param name="sortField"></param> /// <param name="sortOrder"></param> /// <returns></returns> public IList<DbTableSpace> GetTableSpaces(RdbDescriptor db, string sortField, string sortOrder) { if (string.IsNullOrEmpty(sortField)) { sortField = "Rows"; } if (string.IsNullOrEmpty(sortOrder)) { sortOrder = "asc"; } Debug.Assert(sortOrder == "asc" || sortOrder == "desc"); string sql = @"CREATE TABLE #T ( Name VARCHAR(255) , [Rows] BIGINT , Reserved VARCHAR(20) , Data VARCHAR(20) , IndexSize VARCHAR(20) , UnUsed VARCHAR(20) ) EXEC SP_MSFOREACHTABLE ""INSERT INTO #T EXEC SP_SPACEUSED '?'"" SELECT * FROM #T ORDER BY " + sortField + " " + sortOrder + @" DROP TABLE #T"; var spaces = new List<DbTableSpace>(); using (var reader = db.ExecuteReader(sql, null)) { while (reader.Read()) { spaces.Add(DbTableSpace.Create(reader)); } reader.Close(); } return spaces; }
/// <summary> /// /// </summary> /// <param name="db"></param> /// <returns></returns> public IList<DbView> GetDbViews(RdbDescriptor db) { var queryString = _acDomain.Config.SqlServerViewsSelect; var views = new List<DbView>(); using (var reader = db.ExecuteReader(queryString, null)) { while (reader.Read()) { views.Add(new DbView(db.Database.Id, reader)); } reader.Close(); } return views; }
/// <summary> /// /// </summary> /// <param name="db"></param> /// <returns></returns> public IList<DbTable> GetDbTables(RdbDescriptor db) { var sql = _acDomain.Config.SqlServerTablesSelect; var tables = new List<DbTable>(); using (var reader = db.ExecuteReader(sql, null)) { while (reader.Read()) { tables.Add(new DbTable(db.Database.Id, reader)); } reader.Close(); } return tables; }
/* * sys.sp_addextendedproperty @name = NULL, -- sysname @value = NULL, -- sql_variant @level0type = '', -- varchar(128) @level0name = NULL, -- sysname @level1type = '', -- varchar(128) @level1name = NULL, -- sysname @level2type = '', -- varchar(128) @level2name = NULL -- sysname sys.sp_updateextendedproperty @name = NULL, -- sysname @value = NULL, -- sql_variant @level0type = '', -- varchar(128) @level0name = NULL, -- sysname @level1type = '', -- varchar(128) @level1name = NULL, -- sysname @level2type = '', -- varchar(128) @level2name = NULL -- sysname sys.sp_dropextendedproperty @name = NULL, -- sysname @level0type = '', -- varchar(128) @level0name = NULL, -- sysname @level1type = '', -- varchar(128) @level1name = NULL, -- sysname @level2type = '', -- varchar(128) @level2name = NULL -- sysname */ /// <summary> /// /// </summary> /// <param name="db"></param> /// <param name="id"></param> /// <param name="description"></param> /// <param name="metaDataType"></param> public void CrudDescription(RdbDescriptor db, RDbMetaDataType metaDataType, string id, string description) { const string addProcName = "sys.sp_addextendedproperty"; const string updateProcName = "sys.sp_updateextendedproperty"; const string dropProcName = "sys.sp_dropextendedproperty"; const string propertyName = "MS_Description"; switch (metaDataType) { case RDbMetaDataType.Database: break; case RDbMetaDataType.Table: #region Table DbTable table; if (!db.TryGetDbTable(id, out table)) { throw new AnycmdException("意外的数据库表" + id); } if (description == null && table.Description != null) { db.ExecuteNonQuery(dropProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", table.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", table.Name, DbType.String)); } else if (table.Description == null) { db.ExecuteNonQuery(addProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", table.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", table.Name, DbType.String)); } else { db.ExecuteNonQuery(updateProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", table.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", table.Name, DbType.String)); } table.Description = description; #endregion break; case RDbMetaDataType.View: #region View DbView view; if (!db.TryGetDbView(id, out view)) { throw new AnycmdException("意外的数据库视图" + id); } if (description == null && view.Description != null) { db.ExecuteNonQuery(dropProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", view.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", view.Name, DbType.String)); } else if (view.Description == null) { db.ExecuteNonQuery(addProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", view.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", view.Name, DbType.String)); } else { db.ExecuteNonQuery(updateProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", view.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", view.Name, DbType.String)); } view.Description = description; #endregion break; case RDbMetaDataType.TableColumn: #region TableColumn DbTableColumn tableColumn; if (!db.AcDomain.Rdbs.DbTableColumns.TryGetDbTableColumn(db, id, out tableColumn)) { throw new AnycmdException("意外的数据库表列标识" + id); } if (description == null && tableColumn.Description != null) { db.ExecuteNonQuery(dropProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", tableColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", tableColumn.TableName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", tableColumn.Name, DbType.String)); } else if (tableColumn.Description == null) { db.ExecuteNonQuery(addProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", tableColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", tableColumn.TableName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", tableColumn.Name, DbType.String)); } else { db.ExecuteNonQuery(updateProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", tableColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "TABLE", DbType.String), CreateParameter(db, "level1name", tableColumn.TableName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", tableColumn.Name, DbType.String)); } tableColumn.Description = description; #endregion break; case RDbMetaDataType.ViewColumn: #region ViewColumn DbViewColumn viewColumn; if (!db.AcDomain.Rdbs.DbViewColumns.TryGetDbViewColumn(db, id, out viewColumn)) { throw new AnycmdException("意外的数据库视图列标识" + id); } if (description == null && viewColumn.Description != null) { db.ExecuteNonQuery(dropProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", viewColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", viewColumn.ViewName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", viewColumn.Name, DbType.String)); } else if (viewColumn.Description == null) { db.ExecuteNonQuery(addProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", viewColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", viewColumn.ViewName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", viewColumn.Name, DbType.String)); } else { db.ExecuteNonQuery(updateProcName, CommandType.StoredProcedure, CreateParameter(db, "name", propertyName, DbType.String), CreateParameter(db, "value", description, DbType.String), CreateParameter(db, "level0type", "SCHEMA", DbType.String), CreateParameter(db, "level0name", viewColumn.SchemaName, DbType.String), CreateParameter(db, "level1type", "VIEW", DbType.String), CreateParameter(db, "level1name", viewColumn.ViewName, DbType.String), CreateParameter(db, "level2type", "COLUMN", DbType.String), CreateParameter(db, "level2name", viewColumn.Name, DbType.String)); } viewColumn.Description = description; #endregion break; default: break; } }