예제 #1
0
        public void G10_InsertCharSerialPrimaryKey()
        {
            Northwind  dbo = CreateDB();
            Northwind1 db  = new Northwind1(dbo.Connection);

            try
            {
                db.ExecuteCommand(
                    @"create sequence seq8;
create temp table cust1 ( CustomerID char(10) DEFAULT nextval('seq8'),
dummy text
);
");

                Table <Northwind1.Cust1> cust1s =
                    db.GetTable <Northwind1.Cust1>();

                var cust1 = new Northwind1.Cust1();
                cust1.Dummy = "";
                db.Cust1s.InsertOnSubmit(cust1);
                db.SubmitChanges();
                Assert.IsNotNull(cust1.CustomerId);
            }
            finally
            {
                try { db.ExecuteCommand("drop table cust1;"); }
                catch { }
                try { db.ExecuteCommand("drop sequence seq8;"); }
                catch { }
            }
        }
예제 #2
0
파일: WriteTest.cs 프로젝트: nlhepler/mono
        public void G10_InsertCharSerialPrimaryKey()
        {
            Northwind dbo = CreateDB();
            Northwind1 db = new Northwind1(dbo.Connection);
            try
            {
                db.ExecuteCommand(
                    @"create sequence seq8;
create temp table cust1 ( CustomerID char(10) DEFAULT nextval('seq8'),
dummy text
);
");

                Table<Northwind1.Cust1> cust1s =
                    db.GetTable<Northwind1.Cust1>();

                var cust1 = new Northwind1.Cust1();
                cust1.Dummy = "";
                db.Cust1s.InsertOnSubmit(cust1);
                db.SubmitChanges();
                Assert.IsNotNull(cust1.CustomerId);
            }
            finally
            {
                try { db.ExecuteCommand("drop table cust1;"); }
                catch { }
                try { db.ExecuteCommand("drop sequence seq8;"); }
                catch { }
            }
        }