作者:mobiledu2502913173 | 来源:互联网 | 2023-08-13 17:25
1.DynamicsCRM365控制并发的处理方式:A.在数据库端控制,可以设置唯一聚集索引来处理。B.在进程端处理由于自动编号只在Plugin触发,所以这里可以在进程端处理usi
1.Dynamics CRM 365控制并发的处理方式:A.在数据库端控制,可以设置唯一聚集索引来处理。B.在进程端处理
由于自动编号只在Plugin触发,所以这里可以在进程端处理
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
Thread th = new Thread(new ParameterizedThreadStart(thread1));
th.Name = "111";
Thread th1 = new Thread(new ParameterizedThreadStart(thread2));
th1.Name = "222";
Thread th2 = new Thread(new ParameterizedThreadStart(thread3));
th2.Name = "333";
th.Start("11");
th1.Start("11");
th2.Start("11");
Console.ReadKey();
}
static void Done(object name)
{
Console.WriteLine("开始执行" + Thread.CurrentThread.Name);
lock (name.ToString())
{
Console.WriteLine("进入休眠区" + Thread.CurrentThread.Name);
Thread.Sleep(20000);
Console.WriteLine("推出休眠区"+ Thread.CurrentThread.Name);
}
}
static void thread1(object name)
{
Done(name);
}
static void thread2(object name)
{
Done(name);
}
static void thread3(object name)
{
Done(name);
}
}
}
记得收藏并关注,掌握更多相关知识!!!