Пример #1
0
        public void Table_AsColumn()
        {
            // Tables are usable as Columns, allowing nesting a full table of columns as a single named column.
            // Test Table ILimitedList members by using the Column.Basics testing.

            V1.PersonDatabase db               = new V1.PersonDatabase();
            V1.PersonTable    other            = db.Person;
            V1.Person         defaultPerson    = new Person(other);
            V1.Person         nonDefaultPerson = new Person(other)
            {
                Age = 39, Name = "Scott"
            };

            Column.Basics <V1.Person>(
                () => new PersonTable(new PersonDatabase()),
                defaultPerson,
                nonDefaultPerson,
                (i) => new Person(other)
            {
                Age = (byte)(i % byte.MaxValue)
            }
                );

            // Set to already correct instance
            string name = other[1].Name;

            other[1] = other[1];
            Assert.Equal(name, other[1].Name);

            // Verify Add detects already is last Table item
            int count = other.Count;

            other.Add(other[count - 1]);
            Assert.Equal(count, other.Count);
        }
Пример #2
0
 internal Person(PersonTable table, int index)
 {
     this._table = table;
     this._index = index;
 }
Пример #3
0
 internal Person(PersonTable table) : this(table, table.Add()._index)
 {
     Init();
 }
Пример #4
0
 void IRow.Remap(ITable table, int index)
 {
     _table = (PersonTable)table;
     _index = index;
 }
Пример #5
0
 public override void GetOrBuildTables()
 {
     Person    = GetOrBuild(nameof(Person), () => new PersonTable(this));
     Community = GetOrBuild(nameof(Community), () => new CommunityTable(this));
 }
Пример #6
0
 internal Person(PersonTable table) : this(table, table.Count)
 {
     table.Add();
 }