xpo 多线程安全 问题解决

    program.cs 文件添加一行:

            static void Main()
            {
                ConnectionHelper.Connect(AutoCreateOption.DatabaseAndSchema,true);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }

    多线程使用测试:

    private void btnMutiThread_Click(object sender, EventArgs e)
            {
                for (int i = 0; i < 5; i++)
                {
                    Thread thread = new Thread(AddOp);
                    thread.Start();
                }
            }
    
            static void AddOp()
            {
                using (var session = new Session())
                {
                    think_operation to = new think_operation(session)
                    {
                        active_id = 1,
                        oper = "hhhhhh",
                        oper_time = DateTime.Now,
                        operName = "sssssssssss",
                        user_id = 3,
                    };
                    to.Save();
                }
            }

Notice: Undefined variable: cao_ver in /data/wwwroot/www.lingkb.com/wp-content/plugins/riprodl/old.php on line 409

发表评论

发表评论