SloRecord ReadSingleResult(IDataRecord record) { var slo = new SloRecord(); ThreadContext <SloParsingContext> .Set(new SloParsingContext(slo)); slo.ServiceId = record["ServiceId"] as string; slo.OrganizationName = record["OrganizationName"] as string; slo.ServiceGroupName = record["ServiceGroupName"] as string; slo.TeamGroupName = record["TeamGroupName"] as string; slo.ServiceName = record["ServiceName"] as string; slo.SetYamlValue(record["YamlValue"] as string); if (!record.IsDBNull(record.GetOrdinal("ReviewPassed"))) { slo.ReviewPassed = ((sbyte)record.GetValue(record.GetOrdinal("ReviewPassed")) != 0); } slo.ReviewDetails = record["ReviewDetails"] as string; if (!record.IsDBNull(record.GetOrdinal("ReviewDate"))) { slo.ReviewDate = record.GetDateTime(record.GetOrdinal("ReviewDate")); } slo.ReviewedBy = record["ReviewedBy"] as string; return(slo); }
/// <summary> /// Populate <see cref="SloRecord"/> model with the <paramref name="record"/> data obtained from running the Kusto query. /// </summary> /// <param name="record">Kusto data mapped as <see cref="IDataRecord"/> from a single entry.</param> /// <returns><see cref="SloRecord"/> object that contains service and review data.</returns> SloRecord ReadSingleResult(IDataRecord record) { var slo = new SloRecord(); ThreadContext <SloParsingContext> .Set(new SloParsingContext(slo)); slo.ServiceId = record["ServiceId"] as string; slo.OrganizationName = record["OrganizationName"] as string; slo.ServiceGroupName = record["ServiceGroupName"] as string; slo.TeamGroupName = record["TeamGroupName"] as string; slo.ServiceName = record["ServiceName"] as string; slo.SetYamlValue(record["YamlValue"] as string); slo.ReviewPassed = Convert.ToBoolean(record["ReviewPassed"]); slo.ReviewDetails = record["ReviewDetails"].ToString(); slo.ReviewDate = !record.IsDBNull(record.GetOrdinal("ReviewDate")) ? (DateTime)record["ReviewDate"] : new DateTime(); slo.ReviewedBy = record["ReviewedBy"].ToString(); slo.AdvancedReviewRequired = !record.IsDBNull(record.GetOrdinal("AdvancedReviewRequired")) ? Convert.ToBoolean(record["AdvancedReviewRequired"]) : false; slo.AcknowledgmentDetails = record["AcknowledgmentDetails"].ToString(); slo.AcknowledgmentDate = !record.IsDBNull(record.GetOrdinal("AcknowledgmentDate")) ? (DateTime)record["AcknowledgmentDate"] : new DateTime(); slo.AcknowledgedBy = record["AcknowledgedBy"].ToString(); slo.AcknowledgedYamlValue = record["SloDefinition"].ToString(); return(slo); }