/// <summary> /// 获取运行日志 /// </summary> /// <param name="id">标识Id</param> /// <returns>运行日志</returns> public RunningLog Single(Guid id) { string sql = "SELECT * FROM \"RunningLogs\" WHERE \"Id\" = @Id"; using (IDataReader reader = _SqlHelper.ExecuteReader(sql, new FbParameter("@Id", id))) { if (reader.Read()) { return(this.GetEntity(reader)); } throw new NullReferenceException($"Id为\"{id}\"的运行日志不存在!"); } }
//Internal #region # 获取唯一序列种子 —— SerialSeed SingleOrDefault(string seedName... /// <summary> /// 获取唯一序列种子, /// </summary> /// <param name="seedName">种子名称</param> /// <param name="prefix">前缀</param> /// <param name="timestamp">时间戳</param> /// <param name="serialLength">流水长度</param> /// <returns>序列种子</returns> /// <remarks>如没有,则返回null</remarks> public SerialSeed SingleOrDefault(string seedName, string prefix, string timestamp, int serialLength) { StringBuilder sqlBuilder = new StringBuilder(); sqlBuilder.Append("SELECT * FROM \"SerialSeeds\" "); sqlBuilder.Append("WHERE \"Name\" = @Name "); sqlBuilder.Append("AND \"Prefix\" = @Prefix "); sqlBuilder.Append("AND \"Timestamp\" = @Timestamp "); sqlBuilder.Append("AND \"SerialLength\" = @SerialLength "); IDbDataParameter[] parameters = { new FbParameter("@Name", seedName.ToDbValue()), new FbParameter("@Prefix", prefix.ToDbValue()), new FbParameter("@Timestamp", timestamp.ToDbValue()), new FbParameter("@SerialLength", serialLength.ToDbValue()) }; using (IDataReader reader = _SqlHelper.ExecuteReader(sqlBuilder.ToString(), parameters)) { return(reader.Read() ? this.ToModel(reader) : null); } }