Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
            }
        }