Esempio n. 1
0
        public static void NotNull()
        {
            var nullRowId = RowId.Null;
            var rowId     = new RowId(1, 32);

            Assert.AreNotEqual(rowId, nullRowId);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        /// <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;
        }
Esempio n. 6
0
 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));
 }
Esempio n. 8
0
 /// <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);
 }
Esempio n. 9
0
 /// <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);
 }