public NonNullTypeNode( Location location, INullableType type) { Location = location; Type = type ?? throw new ArgumentNullException(nameof(type)); }
public bool IsValid(IStructuralItem modelItem) { INullableType nullableType = modelItem as INullableType; // Get underlying type if it is an INullableType. modelItem = null != nullableType ? nullableType.UnderlyingType : modelItem; // Ensure the type matches the business type, // or the underlying type while (modelItem is ISemanticType) { if (String.Equals(((ISemanticType)modelItem).Id, "ApressExtensionCS:DurationType", StringComparison.Ordinal)) { return(true); } modelItem = ((ISemanticType)modelItem).UnderlyingType; } //Don't apply the validation if the conditions aren't met return(false); }
public NonNullTypeNode WithType(INullableType type) { return(new NonNullTypeNode(Location, Type)); }