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); }
internal PersonTable(PersonDatabase database) : base() { Database = database; Age = AddColumn(nameof(Age), database.BuildColumn <byte>(nameof(Person), nameof(Age), default)); Name = AddColumn(nameof(Name), database.BuildColumn <string>(nameof(Person), nameof(Name), default)); }
internal CommunityTable(PersonDatabase database) : base() { Database = database; People = AddColumn(nameof(People), new RefListColumn(nameof(PersonDatabase.Person))); }
internal Person(PersonDatabase database, Person other) : this(database.Person) { CopyFrom(other); }
public PersonTable(IDatabase database, Dictionary <string, IColumn> columns = null) : base(database, columns) { Database = (PersonDatabase)database; GetOrBuildColumns(); }
internal static Person Copy(PersonDatabase database, Person other) { return(other == null ? null : new Person(database, other)); }