public CommonScope(DataAccess dac) { try { this.dac = dac; if (this.scope == null) { dac.Scope = this; this.scope = new TransactionScope(); dac.conn.Open(); } } catch (Exception exception) { throw new CommonException("事务中打开数据库连接出错. 连接串:" + dac.conn.ConnectionString, exception, CommonDeclare.EnumExceptionLevel.FAULT); } }
/// <summary> /// 根据传入的数据连接及事务控件对象启用事务控制 /// </summary> /// <param name="dac">数据连接入事务控制对象</param> public CM_UserListService(DataAccess dac) { this.dac = dac; }
/// <summary> /// 根据传入的数据连接及事务控件对象启用事务控制 /// </summary> /// <param name="dac">数据连接入事务控制对象</param> public CM_UserListDBO(DataAccess dac) { this.dac = dac; }
protected BusinessObject(DataAccess da) { this.dac = new DataAccess(""); this.dac = da; }
/// <summary> /// 默认构造函数总是执行,除非用:base指定构造函数,启用默认数据库连接 /// 传入DataAccess da也会执行浪费资源可以改进 /// </summary> protected BusinessObject() { this.dac = new DataAccess(""); }