/// <summary> /// 根据数据库连接字符串初始化对象 /// </summary> /// <param name="constr">提供数据库连接字符串,不能为null或空串</param> protected DbAccessBase(string constr) { // 断言连接字符串不为null或空串 PreconditionAssert.IsFalse(string.IsNullOrEmpty(constr), ErrorMessages.DBConnectionStringIsNullOrEmpty); _engine = new DbEngine(Factory, constr); ConnectionTimeout = 60; CommandTimeout = 60; }
public int ExecCommand(DbCommand cmd) { PreconditionAssert.IsFalse(cmd == null, ErrorMessages.CommandTextIsNullOrEmpty); try { _engine.BeginAction(); return(this.DoExecCommand(cmd)); } finally { _engine.FinishAction(); } }