public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { var result = new List<ValidationResult>(); result.AddRange(base.Validate(validationContext)); if (When == null) result.Add(new ValidationResult("A DeletedEntry must have a non-null deletion time (When)")); if (!result.Any()) result.Add(ValidationResult.Success); return result; }
public static Expression NonUcumIndexedExpression(this FM.Quantity quantity) { var values = new List<ValueExpression>(); if (quantity.System != null) values.Add(new IndexValue("system", new StringValue(quantity.System))); if (quantity.Unit != null) values.Add(new IndexValue("unit", new StringValue(quantity.Unit))); if (quantity.Value.HasValue) values.Add(new IndexValue("value", new NumberValue(quantity.Value.Value))); if (values.Any()) return new CompositeValue(values); return null; }
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { var result = new List<ValidationResult>(); result.AddRange(base.Validate(validationContext)); if (!result.Any()) result.Add(ValidationResult.Success); return result; }
private String describeInvariants(List<Profile.ElementDefinitionConstraintComponent> constraints) { if (constraints == null || !constraints.Any()) return null; StringBuilder s = new StringBuilder(); if (constraints.Count > 0) { s.Append("<b>Defined on this element</b><br/>\r\n"); var b = false; foreach (var inv in constraints.OrderBy(constr => constr.Key)) { if (b) s.Append("<br/>"); else b = true; s.Append("<b title=\"Formal Invariant Identifier\">Inv-" + inv.Key + "</b>: " + WebUtility.HtmlEncode(inv.Human) + " (xpath: " + WebUtility.HtmlEncode(inv.Xpath) + ")"); } } return s.ToString(); }
private String describeTypes(Profile profile, List<Profile.TypeRefComponent> types) { if (types == null || !types.Any()) return null; if (types.Count == 1) return describeType(profile, types[0]); else { return "Choice of: " + String.Join(", ", types.Select(t => describeType(profile, t))); } }