public void TestReader()
        {
            var connectString = TestUtils.GetLocalDBConnectionString();
            //init database
            Database.SetInitializer(new DropCreateDatabaseAlways<MyContext>());
            var context = new MyContext(connectString);
            context.Inits.Add(new Init());
            context.SaveChanges();

            #region init sample data

            var entities = new List<Entity>
             {
                 new Entity
                 {
                     Id = 1,
                     PersonName = "zhang san",
                     PhoneNumber = "110",
                     Location = new Location{RoadNumber = 1, RoadName = "first"}
                 },
                 new Entity
                 {
                     Id = 2,
                     PersonName = "li si",
                     PhoneNumber = "119",
               //      Location = new Location{RoadNumber = 2, RoadName = "second", RoadMap = new RoadMap{Id=2}}
                    Address = new Address{AddressNumber = 10}
                 }
             };

            var entities2 = new List<Entity>
            {
                new Entity
                {
                    Id = 3,
                    PersonName = "wang er",
                    PhoneNumber = "120"
                }
            };

            #endregion
            #region add to db

            using (var connection = new SqlConnection(connectString))
            {
                connection.Open();

                // Wd:
                var wdAccessor = TypeAccessorManager<Entity>.GetAccessorForTable(new TargetTable(GSProduct.WD, connectString, "dbo.Wds"));
                var wdReader2 = new BulkDataReader<Entity>(wdAccessor, entities);
                using (var bulkCopy = new SqlBulkCopy(connection))
                {
                    foreach (SqlBulkCopyColumnMapping map in wdReader2.ColumnMappings)
                    {
                        bulkCopy.ColumnMappings.Add(map);
                    }
                    bulkCopy.DestinationTableName = "dbo.Wds";

                    bulkCopy.WriteToServer(wdReader2);
                }

                //Cd:
                var cdAccessor = TypeAccessorManager<Entity>.GetAccessorForTable(new TargetTable(GSProduct.CD, connectString,"dbo.Cds"));
                var cdReader2 = new BulkDataReader<Entity>(cdAccessor, entities);
                using (var bulkCopy = new SqlBulkCopy(connection))
                {
                    foreach (SqlBulkCopyColumnMapping map in cdReader2.ColumnMappings)
                    {
                        bulkCopy.ColumnMappings.Add(map);
                    }
                    bulkCopy.DestinationTableName = "dbo.Cds";

                    bulkCopy.WriteToServer(cdReader2);
                }

                //Wd 2: use debug model to test whether this new WdAccessor is new build or not
                //right: this WdAccessor should just get from TypeAccessorManager, it can not be rebuild.
                var wdAccessor2 =
                    TypeAccessorManager<Entity>.GetAccessorForTable(
                        new TargetTable(GSProduct.WD, connectString, "dbo.Wds"));
                var wdReader22 = new BulkDataReader<Entity>(wdAccessor2, entities2);
                using (var bulkCopy = new SqlBulkCopy(connection))
                {
                    foreach (var map in wdReader22.ColumnMappings)
                    {
                        bulkCopy.ColumnMappings.Add(map);
                    }
                    bulkCopy.DestinationTableName = "dbo.Wds";
                    bulkCopy.WriteToServer(wdReader22);
                }
            }
            #endregion

            #region reader from db and test whether data is exist.

            //wd
            Assert.AreEqual(3, context.Wds.Count());
            Assert.AreEqual("li si", context.Wds.FirstOrDefault(w => w.WdId == 2).Name);
            Assert.AreEqual("110", context.Wds.FirstOrDefault(w => w.WdId == 1).PhoneNumber);
            var entity = context.Wds.FirstOrDefault();
            Assert.AreEqual(entity.PhoneNumber, entity.PhoneNumber2);

            //Cd
            Assert.AreEqual(2, context.Cds.Count());
            Assert.AreEqual("110", context.Cds.FirstOrDefault(c => c.CdId == 1).PhoneNum);
            Assert.AreEqual("first", context.Cds.FirstOrDefault(c => c.CdId == 1).RoadName);
            Assert.AreEqual(null, context.Cds.FirstOrDefault(c => c.CdId == 2).RoadName);

            //Cd default value,the roadnum's default value is -1
            Assert.AreEqual(-1, context.Cds.FirstOrDefault(c => c.CdId == 2).RoadNum);
            Assert.AreEqual(null, context.Cds.FirstOrDefault(c => c.CdId == 2).RoadName);

            //Cd not Product Property
            Assert.AreEqual(10, context.Cds.FirstOrDefault(c => c.CdId == 2).AddressNumber);
            #endregion

            context.Dispose();

        }