多个线程同时访问数据库:注意红色字体
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StudentTest;
using System.Threading;
using Domain;
using NHibernate;
namespace StudentTest
{
class Program
{
static Thread[] thr;
static void Main(string[] args)
{
// int length = 200;
Program p = new Program();
thr = new Thread[100];
for (int i = 0; i < thr.Length; i++)
{
thr[i] = new Thread(new ThreadStart(p.Read));
thr[i].IsBackground = true;
thr[i].Start();
//Thread.Sleep(2000);
}