/// <summary> /// Gets or sets the value stored at the entry whose table and column names are given. /// </summary> /// <param name="tableName">The table name, or null if it refers to the default one in /// this context.</param> /// <param name="columnName">The column name.</param> /// <returns>The value held at the given entry.</returns> public object this[string tableName, string columnName] { get { if (IsDisposed) { throw new ObjectDisposedException(this.ToString()); } if (_Schema == null) { throw new InvalidOperationException("This '{0}' is not associated with any schema.".FormatWith(this)); } tableName = Core.SchemaEntry.ValidateTable(tableName); columnName = Core.SchemaEntry.ValidateColumn(columnName); var entry = _Schema.FindEntry(tableName, columnName); if (entry == null) { throw new NotFoundException( "Entry '{0}' not found in this '{1}'".FormatWith(Core.SchemaEntry.NormalizedName(tableName, columnName), this)); } var index = _Schema.IndexOf(entry); return(_Values[index]); } set { if (IsDisposed) { throw new ObjectDisposedException(this.ToString()); } if (_Schema == null) { throw new InvalidOperationException("This '{0}' is not associated with any schema.".FormatWith(this)); } tableName = Core.SchemaEntry.ValidateTable(tableName); columnName = Core.SchemaEntry.ValidateColumn(columnName); var entry = _Schema.FindEntry(tableName, columnName); if (entry == null) { throw new NotFoundException( "Entry '{0}' not found in this '{1}'".FormatWith(Core.SchemaEntry.NormalizedName(tableName, columnName), this)); } var index = _Schema.IndexOf(entry); _Values[index] = value; } }
/// <summary> /// Gets or sets the value held by the column whose table and column names are given. /// <para>The setter creates dynamically an entry for the given column specification.</para> /// </summary> /// <param name="table">The table name of the entry to find, or null to refer to the /// default one in this context.</param> /// <param name="column">The column name.</param> /// <returns>The value held by the requested entry.</returns> public object this[string table, string column] { get { if (IsDisposed) { throw new ObjectDisposedException(this.ToString()); } table = SchemaEntry.ValidateTable(table); column = SchemaEntry.ValidateColumn(column); var entry = _Schema.FindEntry(table, column); if (entry == null) { throw new NotFoundException( "Entry '{0}' not found in this '{1}'".FormatWith(SchemaEntry.NormalizedName(table, column), this)); } var index = _Schema.IndexOf(entry); return(_Values[index]); } set { if (IsDisposed) { throw new ObjectDisposedException(this.ToString()); } table = SchemaEntry.ValidateTable(table); column = SchemaEntry.ValidateColumn(column); var entry = _Schema.FindEntry(table, column); if (entry == null) { _Schema.AddCreate(table, column); _Values.Add(value); } else { var index = _Schema.IndexOf(entry); _Values[index] = value; } } }