using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DAL
{
/// <summary>
/// 数据访问类
/// </summary>
public class empdal
{
private static empdal da;//创建服务类对象
private static readonly object obj = new object();//创建锁对象
private empdal()
{
}
public static empdal showdal()
{
lock(obj)
{
if(da==null)
{
da = new empdal();
}
return da;
}
}
public int login()
{
return 1;
}
public void go()
{
}
}
}
BLL层
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
namespace BAL
{
public class Class1
{
empdal dal = empdal.showdal();
public int login()
{
return dal.login();
}
}
}