示例#1
0
        public static void m1()
        {
            Builder builder = new Builder(
                typeof(SqlDataMapper <>),
                new Object[] { SqlMapperUnitTest.getMySqlConnectionString() },
                typeof(PropertyColumnMapper),
                typeof(SingleConnectionPolicy));

            IDataMapper <ProductSimple> productMapper = builder.Build <ProductSimple>();
            IConnectionPolicy           policy        = productMapper.GetConnectionPolicy();

            ProductSimple p = productMapper.GetAll().First();

            p.ProductName = "Potatoes";
            productMapper.Update(p);

            ProductSimple p2 = productMapper.GetAll().First();

            p2.ProductName = "Chai";
            productMapper.Update(p2);

            ProductSimple novoP = new ProductSimple();

            novoP.ProductName     = "batatas";
            novoP.QuantityPerUnit = "setenta mil";
            productMapper.Insert(novoP);
        }