DBSesson

public class DBSesson : IDBSesson
{
DbContext db = new book_shopEntities();
private IUserInfoDAL _userInfoDAL;
public IUserInfoDAL UserInfoDAL
{
get
{
if(_userInfoDAL==null)
{
_userInfoDAL = new UserInfoDAL();//抽象工厂
}
return _userInfoDAL;
}
set
{
_userInfoDAL = value;
}
}

    //执行SQL语句
    public int ExecuteSql(string sql, params System.Data.SqlClient.SqlParameter[] pars)
    {
        return db.Database.ExecuteSqlCommand(sql, pars);
    }


    public int SaveChanges()
    {
        return db.SaveChanges();
    }
}

posted on 2015-03-22 22:51  木屐  阅读(104)  评论(0编辑  收藏  举报

导航