Beispiel #1
0
        public void TestContext([IncludeDataSources(
                                     ProviderName.SqlServer2008, ProviderName.SqlServer2012,
                                     ProviderName.SqlServer2014, ProviderName.SapHana)]
                                string context)
        {
            var ctx = new DataContext(context);

            ctx.GetTable <Person>().ToList();

            ctx.KeepConnectionAlive = true;

            ctx.GetTable <Person>().ToList();
            ctx.GetTable <Person>().ToList();

            ctx.KeepConnectionAlive = false;

            using (var tran = new DataContextTransaction(ctx))
            {
                ctx.GetTable <Person>().ToList();

                tran.BeginTransaction();

                ctx.GetTable <Person>().ToList();
                ctx.GetTable <Person>().ToList();

                tran.CommitTransaction();
            }
        }
Beispiel #2
0
        public void TestContext()
        {
            var ctx = new DataContext("Sql2008");

            ctx.GetTable <Person>().ToList();

            ctx.KeepConnectionAlive = true;

            ctx.GetTable <Person>().ToList();
            ctx.GetTable <Person>().ToList();

            ctx.KeepConnectionAlive = false;

            using (var tran = new DataContextTransaction(ctx))
            {
                ctx.GetTable <Person>().ToList();

                tran.BeginTransaction();

                ctx.GetTable <Person>().ToList();
                ctx.GetTable <Person>().ToList();

                tran.CommitTransaction();
            }
        }
Beispiel #3
0
        public void Commit()
        {
            if (this.transaction != null)
            {
                transaction.CommitTransaction();
            }

            this.transaction = null;
        }