public IndexSchema(TableSchema table, string name, bool isPrimaryKey, bool isUnique, bool isClustered, string[] memberColumns, ExtendedProperty[] extendedProperties) : this(table, name, isPrimaryKey, isUnique, isClustered, memberColumns) { this.database = table.Database; this.extendedProperties = new List<ExtendedProperty>(); this.extendedProperties.AddRange(extendedProperties); }
public TableKeySchema(string name, TableSchema foreignKeyTable, TableSchema primaryKeyTable, ExtendedProperty[] extendedProperties) { this.name = name; this.foreignKeyTable = foreignKeyTable; this.primaryKeyTable = primaryKeyTable; this.extendedProperties = new List<ExtendedProperty>(); this.extendedProperties.AddRange(extendedProperties); }
public ColumnSchema(TableSchema table, string name, DbType dataType, string nativeType, int size, byte precision, int scale, bool allowDBNull, ExtendedProperty[] extendedProperties) : this(table, name, dataType, nativeType, size, precision, scale, allowDBNull) { this.extendedProperties = new List<ExtendedProperty>(); this.extendedProperties.AddRange(extendedProperties); }
public ViewSchema(DatabaseSchema database, string name, string owner, DateTime dateCreated, ExtendedProperty[] extendedProperties) : this(database, name, owner, dateCreated) { this.extendedProperties = new List<ExtendedProperty>(); this.extendedProperties.AddRange(extendedProperties); }
public ParameterSchema(CommandSchema command, string name, ParameterDirection direction, DbType dataType, string nativeType, int size, byte precision, int scale, bool allowDBNull, ExtendedProperty[] extendedProperties) : this(command, name, direction, dataType, nativeType, size, precision, scale, allowDBNull) { this.extendedProperties = new List<ExtendedProperty>(); this.extendedProperties.AddRange(extendedProperties); }
public TableKeySchema(DatabaseSchema database, string name, string[] foreignKeyMemberColumns, string foreignKeyTableOwner, string foreignKeyTable, string[] primaryKeyMemberColumns, string primaryKeyTableOwner, string primaryKeyTable, ExtendedProperty[] extendedProperties) : this(database, name, foreignKeyMemberColumns, foreignKeyTableOwner, foreignKeyTable, primaryKeyMemberColumns, primaryKeyTableOwner, primaryKeyTable) { this.extendedProperties = new List<ExtendedProperty>(); this.extendedProperties.AddRange(extendedProperties); }
public MemberColumnSchema(ColumnSchema memberColumn, ExtendedProperty[] extendedProperties) { this.column = memberColumn; this.extendedProperties = new List<ExtendedProperty>(); this.extendedProperties.AddRange(extendedProperties); }
public PrimaryKeySchema(TableSchema table, string name, string[] memberColumns, ExtendedProperty[] extendedProperties) : this(table, name, memberColumns) { this.extendedProperties = new List<ExtendedProperty>(); this.extendedProperties.AddRange(extendedProperties); }
public CommandResultSchema(CommandSchema command, string name, CommandResultColumnSchema[] columns, ExtendedProperty[] extendedProperties) : this(command, name, columns) { this.extendedProperties = new List<ExtendedProperty>(); this.extendedProperties.AddRange(extendedProperties); }
public CommandResultColumnSchema(CommandSchema command, string name, DbType dataType, string nativeType, int size, byte precision, int scale, bool isAllowDBNull, ExtendedProperty[] extendedProperties) : this(command, name, dataType, nativeType, size, precision, scale, isAllowDBNull) { this.extendedProperties = new List<ExtendedProperty>(); this.extendedProperties.AddRange(extendedProperties); }
public ColumnSchema[] GetTableColumns(string connectionString, TableSchema table) { string commandText = string.Format("SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE\r\n, CASE IS_NULLABLE WHEN 'NO' THEN 0 ELSE 1 END IS_NULLABLE,isnull(MS_Description.value,'') as Description\r\nFROM INFORMATION_SCHEMA.COLUMNS as a\r\n left join sys.extended_properties as MS_Description\r\n on MS_Description.major_id=OBJECT_ID(a.TABLE_NAME) and MS_Description.minor_id=a.ORDINAL_Position\r\n WHERE TABLE_CATALOG = '{0}' AND TABLE_NAME = '{1}' ORDER BY ORDINAL_POSITION", table.Database.Name, table.Name); List<ColumnSchema> list = new List<ColumnSchema>(); using (DbConnection dbConnection = MsSqlSchemaProvider.CreateConnection(connectionString)) { dbConnection.Open(); DbCommand dbCommand = dbConnection.CreateCommand(); dbCommand.CommandText = commandText; dbCommand.Connection = dbConnection; using (IDataReader dataReader = dbCommand.ExecuteReader(CommandBehavior.CloseConnection)) { while (dataReader.Read()) { string @string = dataReader.GetString(0); string string2 = dataReader.GetString(1); long num = (!dataReader.IsDBNull(2)) ? ((long)dataReader.GetInt32(2)) : 0L; int precision = (!dataReader.IsDBNull(3)) ? dataReader.GetByte(3) : 0; int scale = (!dataReader.IsDBNull(4)) ? dataReader.GetInt32(4) : 0; int ob = dataReader.GetInt32(5); bool allowDBNull = ob == 1; int size = (num < 2147483647L) ? ((int)num) : 2147483647; string Description = dataReader["Description"].ToString(); DbType dbType = MsSqlSchemaProvider.GetDbType(string2, false); ExtendedProperty[] extendedProperties = new ExtendedProperty[1]; list.Add(new ColumnSchema(table, @string, dbType, string2, size, precision, scale, allowDBNull) { Description = Description }); } if (!dataReader.IsClosed) { dataReader.Close(); } } if (dbConnection.State != ConnectionState.Closed) { dbConnection.Close(); } } return list.ToArray(); }