Example #1
0
        static void Main(string[] args)
        {
            MappingByAttribute();

            var session2 = SessionFactory.OpenSession();

            try
            {
                var tx = session2.BeginTransaction();

                tx.Commit();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.StackTrace);
            }

            try
            {
                var count = 100000;
                for (int i = 0; i < count; i++)
                {
                    var session1 = SessionFactory.OpenSession();
                    SessionList.Add(session1);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.StackTrace);
                //LogHelper.Log("Session Test", LogCategory.Error, ex);
            }

            return;

            var session = SessionFactory.OpenSession();

            var logs = session.QueryOver<Needredorequest>().List();

            //var bigData = new StreamReader(File.OpenRead("test.txt"),Encoding.Unicode).ReadToEnd();
            var bigData = new StreamReader(File.OpenRead("test.txt")).ReadToEnd();

            var redo = new Needredorequest
            {
                Url = "http://www.baidu.com",
                Postdata = "各个个热个个个",
                Redocount = 0,
                Issuccess = false,
                CreateOn = DateTime.Now,
                LastRedo = DateTime.Now
            };

            session.Save(redo);
            session.Flush();

            //var items = session.QueryOver<Doctor>().Take(5).List();

            //var sql = @"select count(*) from DOCTOR";
            //var count = session.CreateSQLQuery(sql).List();
        }
Example #2
0
        static void Main(string[] args)
        {
            MappingByAttribute();

            var session2 = SessionFactory.OpenSession();

            try
            {
                var tx = session2.BeginTransaction();

                tx.Commit();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.StackTrace);
            }



            try
            {
                var count = 100000;
                for (int i = 0; i < count; i++)
                {
                    var session1 = SessionFactory.OpenSession();
                    SessionList.Add(session1);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.StackTrace);
                //LogHelper.Log("Session Test", LogCategory.Error, ex);
            }

            return;


            var session = SessionFactory.OpenSession();

            var logs = session.QueryOver <Needredorequest>().List();


            //var bigData = new StreamReader(File.OpenRead("test.txt"),Encoding.Unicode).ReadToEnd();
            var bigData = new StreamReader(File.OpenRead("test.txt")).ReadToEnd();

            var redo = new Needredorequest
            {
                Url       = "http://www.baidu.com",
                Postdata  = "各个个热个个个",
                Redocount = 0,
                Issuccess = false,
                CreateOn  = DateTime.Now,
                LastRedo  = DateTime.Now
            };

            session.Save(redo);
            session.Flush();



            //var items = session.QueryOver<Doctor>().Take(5).List();

            //var sql = @"select count(*) from DOCTOR";
            //var count = session.CreateSQLQuery(sql).List();
        }