Example #1
0
        /// <summary>
        /// Creates the <see cref="BulkDataTable"/> in the <see cref="BulkDataDatabase"/> and uploads test data.  Use <see cref="ImportAsCatalogue"/> to get
        /// rdmp metadata objects pointing at the table.
        /// </summary>
        public void SetupTestData()
        {
            //make sure database exists
            if (!BulkDataDatabase.Exists())
            {
                BulkDataDatabase.Create();
            }

            //generate some people
            var people = new PersonCollection();

            people.GeneratePeople(5000, r);

            //generate the test data
            var dt = _dataGenerator.GetDataTable(people, ExpectedNumberOfRowsInTestData);

            var tbl = BulkDataDatabase.ExpectTable(BulkDataTable);

            if (tbl.Exists())
            {
                tbl.Drop();
            }

            //create the table but make sure the chi is a primary key and the correct data type and that we have a sensible primary key
            Table = BulkDataDatabase.CreateTable(BulkDataTable, dt, new DatabaseColumnRequest[] {
                new DatabaseColumnRequest("chi", new DatabaseTypeRequest(typeof(string), 10))
                {
                    IsPrimaryKey = true
                },
                new DatabaseColumnRequest("dtCreated", new DatabaseTypeRequest(typeof(DateTime)))
                {
                    IsPrimaryKey = true
                },
                new DatabaseColumnRequest("hb_extract", new DatabaseTypeRequest(typeof(string), 1))
                {
                    IsPrimaryKey = true
                }
            });
        }