我在看李天平的工厂模式的例子,现在在调用bll层时报错
private static readonly ISysManage dal = DataAccess.CreateSysManage();
...
public void AddLog(string time, string loginfo, string Particular)
{
dal.AddLog(time, loginfo, Particular);
}
...
在调用 AddLog时老提示"未将对象引用设置到对象的实例",但是我看了看总是dal=null
不知道为什么,如何处理
private static readonly ISysManage dal = DataAccess.CreateSysManage();
...
public void AddLog(string time, string loginfo, string Particular)
{
dal.AddLog(time, loginfo, Particular);
}
...
在调用 AddLog时老提示"未将对象引用设置到对象的实例",但是我看了看总是dal=null
不知道为什么,如何处理
你缺少了引用?
using LiTianPing.IDAL;
using LiTianPing.Model;
using LiTianPing.DALFactory
李天平的例子里只有这几个引用
好像没有执行
这个引用是必须的,因为你在表示层中调用的dll实际是表示层中的bin下的dll