private void ValidateColumnMapping(object tableCatalog, object tableSchema, object tableName, StormColumnMappedAttribute mapping) { DataTable schema = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[] { tableCatalog, tableSchema, tableName, mapping.ColumnName }); if (schema.Rows.Count == 0) throw new StormConfigurationException("The table named [" + tableName + "] does not contain a column named [" + mapping.ColumnName + "]."); OleDbType columnType = (OleDbType)schema.Rows[0]["DATA_TYPE"]; Type systemType = DbTypeMap.ConvertDbTypeToType(columnType); if (mapping.AttachedTo.PropertyType != systemType) throw new StormConfigurationException("The column [" + mapping.ColumnName + "] in table [" + tableName + "] is of type [" + systemType.FullName + "] but is mapped to a property with type [" + mapping.AttachedTo.PropertyType.FullName + "]."); }
private void ValidateColumnMapping(string tableName, StormColumnMappedAttribute mapping) { DataTable schema = connection.GetSchema("Columns", new string[] { null, tableName, mapping.ColumnName.ToUpper() }); if (schema.Rows.Count == 0) throw new StormConfigurationException("The table named [" + tableName + "] does not contain a column named [" + mapping.ColumnName + "]."); OracleDbType columnType = DbTypeMap.ConvertNameToDbType(schema.Rows[0]["DATATYPE"].ToString()); Type systemType = DbTypeMap.ConvertDbTypeToType(columnType); if (mapping.AttachedTo.PropertyType != systemType) throw new StormConfigurationException("The column [" + mapping.ColumnName + "] in table [" + tableName + "] is of type [" + systemType.FullName + "] but is mapped to a property with type [" + mapping.AttachedTo.PropertyType.FullName + "]."); }