public static void NotNull() { var nullRowId = RowId.Null; var rowId = new RowId(1, 32); Assert.AreNotEqual(rowId, nullRowId); }
public static void ToString(int tableId, long rowNumber, string expected) { var rowId = new RowId(tableId, (int)rowNumber); var s = rowId.ToString(); Assert.AreEqual(expected, s); }
public static void Parse(string s, int tableId, long rowNumber) { RowId rowId = RowId.Null; Assert.DoesNotThrow(() => rowId = RowId.Parse(s)); Assert.IsFalse(rowId.IsNull); Assert.AreEqual(tableId, rowId.TableId); Assert.AreEqual(rowNumber, rowId.RowNumber); }
public bool RemoveRow(RowId rowId) { OnTableEvent(TriggerEventType.BeforeDelete, rowId, null); // TODO: Maybe we should return the row removed here var result = MutableTable.RemoveRow(rowId); OnTableEvent(TriggerEventType.AfterDelete, rowId, null); return(result); }
/// <summary> /// Constructs a new row object for the table given, /// identified by the given <see cref="RowId"/>. /// </summary> /// <param name="table">The table that contains the row.</param> /// <param name="rowId">The unique identifier of the row within the database.</param> /// <exception cref="ArgumentNullException"> /// If the provided <paramref name="table"/> is <c>null</c>. /// </exception> /// <exception cref="ArgumentException"> /// If the <paramref name="table"/> defines any id and this does not /// match the given <paramref name="rowId"/>. /// </exception> public Row(ITable table, RowId rowId) { if (table == null) { throw new ArgumentNullException("table"); } if (!rowId.IsNull && table.TableInfo.Id >= 0 && table.TableInfo.Id != rowId.TableId) { throw new ArgumentException(String.Format("The table ID {0} does not match the identifier specified by the row ID ({1})", table.TableInfo.Id, rowId.TableId)); } Table = table; RowId = rowId; }
private void OnTableEvent(TriggerEventType eventType, RowId rowId, Row row) { Context.FireTriggers(new TableEvent(this, eventType, rowId, row)); }
private void OnTableEvent(TriggerEventTime eventTime, TriggerEventType eventType, RowId rowId, Row row) { Request.Access().FireTriggers(Request, new TableEvent(this, eventTime, eventType, rowId, row)); }
/// <summary> /// Sets the number component of the ID of this column. /// </summary> /// <param name="rowNumber">The zero-based number to set /// for identifying this row.</param> /// <seealso cref="Tables.RowId.RowNumber"/> /// <seealso cref="RowId"/> public void SetRowNumber(int rowNumber) { RowId = new RowId(Table.TableInfo.Id, rowNumber); }
/// <summary> /// Sets the row number part of the identificator /// </summary> /// <param name="number">The unique row number within the underlying table</param> /// <remarks> /// <para> /// When a row is made permanent in a table (by a call to <see cref="IMutableTable.AddRow"/>), /// this method is called to update the address of the /// </para> /// <para> /// If a row has no number locator to the underlying table all access /// methods will throw exceptions. /// </para> /// </remarks> public void SetNumber(int number) { RowId = new RowId(Table.TableInfo.Id, number); }