public void Insert(UploadFileHistory history) { ExceptionHelper.FalseThrow <ArgumentNullException>(history != null, "history"); string sql = ORMapping.GetInsertSql(history, TSqlBuilder.Instance) + TSqlBuilder.Instance.DBStatementSeperator + "SELECT SCOPE_IDENTITY()"; decimal identity = (decimal)DbHelper.RunSqlReturnScalar(sql, AppLogSettings.GetConfig().ConnectionName); history.ID = Decimal.ToInt32(identity); }
public UploadFileHistory Load(int id) { WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder(); builder.AppendItem("ID", id); builder.AppendTenantCode(typeof(UploadFileHistory)); string sql = string.Format("SELECT * FROM WF.UPLOAD_FILE_HISTORY WHERE {0}", builder.ToSqlString(TSqlBuilder.Instance)); DataTable table = DbHelper.RunSqlReturnDS(sql, AppLogSettings.GetConfig().ConnectionName).Tables[0]; ExceptionHelper.FalseThrow(table.Rows.Count > 0, "不能找到ID为{0}的UploadFileHistory的数据"); UploadFileHistory history = new UploadFileHistory(); ORMapping.DataRowToObject(table.Rows[0], history); return(history); }
protected override string GetConnectionName() { return(WfRuntime.ProcessContext.SimulationContext.GetConnectionName(AppLogSettings.GetConfig().ConnectionName)); }