/// <summary> /// Adds a parameter to this function (as the last parameter). /// </summary> /// <param name="parameter">The parameter being added.</param> public void AddParameter(IEdmOperationParameter parameter) { EdmUtil.CheckArgumentNull(parameter, "parameter"); this.parameters.Add(parameter); }
public AmbiguousTermBinding(IEdmTerm first, IEdmTerm second) : base(first, second) { this.first = first; this.fullName = EdmUtil.GetFullNameForSchemaElement(this.Namespace, this.Name); }
/// <summary> /// Initializes a new instance of <see cref="EdmReferentialConstraint"/>. /// </summary> /// <param name="propertyPairs">The set of property pairs from the referential constraint.</param> public EdmReferentialConstraint(IEnumerable <EdmReferentialConstraintPropertyPair> propertyPairs) { EdmUtil.CheckArgumentNull(propertyPairs, "propertyPairs"); this.propertyPairs = propertyPairs.ToList(); }
/// <summary> /// Returns true if this reference refers to an enumeration type. /// </summary> /// <param name="type">Type reference.</param> /// <returns>This reference refers to an enumeration type.</returns> public static bool IsEnum(this IEdmTypeReference type) { EdmUtil.CheckArgumentNull(type, "type"); return(type.TypeKind() == EdmTypeKind.Enum); }
/// <summary> /// Returns true if this reference refers to a type definition. /// </summary> /// <param name="type">Type reference.</param> /// <returns>This reference refers to a type definition.</returns> public static bool IsTypeDefinition(this IEdmTypeReference type) { EdmUtil.CheckArgumentNull(type, "type"); return(type.TypeKind() == EdmTypeKind.TypeDefinition); }
protected BadNamedStructuredType(string qualifiedName, IEnumerable <EdmError> errors) : base(errors) { qualifiedName = qualifiedName ?? string.Empty; EdmUtil.TryGetNamespaceNameFromQualifiedName(qualifiedName, out this.namespaceName, out this.name, out this.fullName); }
public AmbiguousOperationBinding(IEdmOperation first, IEdmOperation second) : base(first, second) { this.first = first; this.fullName = EdmUtil.GetFullNameForSchemaElement(this.Namespace, this.Name); }
/// <summary> /// Returns true if this reference refers to a DateTimeOffset type. /// </summary> /// <param name="type">Type reference.</param> /// <returns>This reference refers to a DateTimeOffset type.</returns> public static bool IsDateTimeOffset(this IEdmTypeReference type) { EdmUtil.CheckArgumentNull(type, "type"); return(type.PrimitiveKind() == EdmPrimitiveTypeKind.DateTimeOffset); }
/// <summary> /// Returns true if this reference refers to a stream type. /// </summary> /// <param name="type">Type reference.</param> /// <returns>This reference refers to a stream type.</returns> public static bool IsStream(this IEdmTypeReference type) { EdmUtil.CheckArgumentNull(type, "type"); return(type.PrimitiveKind() == EdmPrimitiveTypeKind.Stream); }
/// <summary> /// Returns true if this reference refers to a primitive type. /// </summary> /// <param name="type">Type reference.</param> /// <returns>This reference refers to a primitive type.</returns> public static bool IsPrimitive(this IEdmTypeReference type) { EdmUtil.CheckArgumentNull(type, "type"); return(type.TypeKind() == EdmTypeKind.Primitive); }
/// <summary> /// Returns true if this reference refers to a temporal type. /// </summary> /// <param name="type">Type reference.</param> /// <returns>This reference refers to a temporal type.</returns> public static bool IsTemporal(this IEdmTypeReference type) { EdmUtil.CheckArgumentNull(type, "type"); return(type.PrimitiveKind().IsTemporal()); }
/// <summary> /// Returns the text representation of the current object. /// </summary> /// <param name="property">Reference to the calling object.</param> /// <returns>The text representation of the current object.</returns> public static string ToTraceString(this IEdmProperty property) { EdmUtil.CheckArgumentNull(property, "property"); return((property.Name != null ? property.Name : "") + ":" + (property.Type != null ? property.Type.ToTraceString() : "")); }
/// <summary> /// Creates two navigation properties representing an association between two entity types. /// </summary> /// <param name="propertyName">Navigation property name.</param> /// <param name="propertyType">Type of the navigation property.</param> /// <param name="dependentProperties">Dependent properties of the navigation source.</param> /// <param name="principalProperties">Principal properties of the navigation source.</param> /// <param name="containsTarget">A value indicating whether the navigation source logically contains the navigation target.</param> /// <param name="onDelete">Action to take upon deletion of an instance of the navigation source.</param> /// <param name="partnerPropertyName">Navigation partner property name.</param> /// <param name="partnerPropertyType">Type of the navigation partner property.</param> /// <param name="partnerDependentProperties">Dependent properties of the navigation target.</param> /// <param name="partnerPrincipalProperties">Principal properties of the navigation target.</param> /// <param name="partnerContainsTarget">A value indicating whether the navigation target logically contains the navigation source.</param> /// <param name="partnerOnDelete">Action to take upon deletion of an instance of the navigation target.</param> /// <returns>Navigation property.</returns> public static EdmNavigationProperty CreateNavigationPropertyWithPartner( string propertyName, IEdmTypeReference propertyType, IEnumerable <IEdmStructuralProperty> dependentProperties, IEnumerable <IEdmStructuralProperty> principalProperties, bool containsTarget, EdmOnDeleteAction onDelete, string partnerPropertyName, IEdmTypeReference partnerPropertyType, IEnumerable <IEdmStructuralProperty> partnerDependentProperties, IEnumerable <IEdmStructuralProperty> partnerPrincipalProperties, bool partnerContainsTarget, EdmOnDeleteAction partnerOnDelete) { EdmUtil.CheckArgumentNull(propertyName, "propertyName"); EdmUtil.CheckArgumentNull(propertyType, "propertyType"); EdmUtil.CheckArgumentNull(partnerPropertyName, "partnerPropertyName"); EdmUtil.CheckArgumentNull(partnerPropertyType, "partnerPropertyType"); IEdmStructuredType declaringType = null; if (partnerPropertyType.Definition.TypeKind == EdmTypeKind.Entity) { declaringType = GetEntityType(partnerPropertyType) as IEdmEntityType; if (declaringType == null) { throw new ArgumentException(Strings.Constructable_EntityTypeOrCollectionOfEntityTypeExpected, nameof(partnerPropertyType)); } } else if (partnerPropertyType.Definition.TypeKind == EdmTypeKind.Complex) { declaringType = GetComplexType(partnerPropertyType) as IEdmComplexType; if (declaringType == null) { throw new ArgumentException(Strings.Constructable_EntityTypeOrCollectionOfEntityTypeExpected, nameof(partnerPropertyType)); } } else { throw new ArgumentException(Strings.Constructable_EntityTypeOrCollectionOfEntityTypeExpected, nameof(partnerPropertyType)); } IEdmEntityType partnerDeclaringType = GetEntityType(propertyType); if (partnerDeclaringType == null) { throw new ArgumentException(Strings.Constructable_EntityTypeOrCollectionOfEntityTypeExpected, nameof(propertyType)); } EdmNavigationProperty end1 = new EdmNavigationProperty( declaringType, propertyName, propertyType, dependentProperties, principalProperties, containsTarget, onDelete); EdmNavigationProperty end2 = new EdmNavigationProperty( partnerDeclaringType, partnerPropertyName, partnerPropertyType, partnerDependentProperties, partnerPrincipalProperties, partnerContainsTarget, partnerOnDelete); end1.SetPartner(end2, new EdmPathExpression(end2.Name)); end2.SetPartner(end1, new EdmPathExpression(end1.Name)); return(end1); }
/// <summary> /// Initializes a new instance of the <see cref="EdmNamedElement"/> class. /// </summary> /// <param name="name">Name of the element.</param> protected EdmNamedElement(string name) { EdmUtil.CheckArgumentNull(name, "name"); this.name = name; }
/// <summary> /// Adds a schema element to this model. /// </summary> /// <param name="element">The element to register.</param> protected void RegisterElement(IEdmSchemaElement element) { EdmUtil.CheckArgumentNull(element, "element"); RegistrationHelper.RegisterSchemaElement(element, this.schemaTypeDictionary, this.termDictionary, this.functionDictionary, this.containersDictionary); }
/// <summary> /// Returns true if this reference refers to a spatial type. /// </summary> /// <param name="type">Type reference.</param> /// <returns>This reference refers to a spatial type.</returns> public static bool IsSpatial(this IEdmTypeReference type) { EdmUtil.CheckArgumentNull(type, "type"); return(IsSpatial(type.Definition)); }
/// <summary> /// Adds a model reference to this model. /// </summary> /// <param name="model">The model to reference.</param> protected void AddReferencedModel(IEdmModel model) { EdmUtil.CheckArgumentNull(model, "model"); this.referencedEdmModels.Add(model); }
// The As*** functions never return null -- if the supplied type does not have the appropriate shape, an encoding of a bad type is returned. #region AsPrimitive, AsCollection, AsStructured, ... /// <summary> /// If this reference is of a primitive type, this will return a valid primitive type reference to the type definition. Otherwise, it will return a bad primitive type reference. /// </summary> /// <param name="type">Reference to the calling object.</param> /// <returns>A valid primitive type reference if the definition of the reference is of a primitive type. Otherwise a bad primitive type reference.</returns> public static IEdmPrimitiveTypeReference AsPrimitive(this IEdmTypeReference type) { EdmUtil.CheckArgumentNull(type, "type"); IEdmPrimitiveTypeReference reference = type as IEdmPrimitiveTypeReference; if (reference != null) { return(reference); } IEdmType typeDefinition = type.Definition; if (typeDefinition.TypeKind == EdmTypeKind.Primitive) { var primitiveDefinition = typeDefinition as IEdmPrimitiveType; if (primitiveDefinition != null) { switch (primitiveDefinition.PrimitiveKind) { case EdmPrimitiveTypeKind.Boolean: case EdmPrimitiveTypeKind.Byte: case EdmPrimitiveTypeKind.Double: case EdmPrimitiveTypeKind.Guid: case EdmPrimitiveTypeKind.Int16: case EdmPrimitiveTypeKind.Int32: case EdmPrimitiveTypeKind.Int64: case EdmPrimitiveTypeKind.SByte: case EdmPrimitiveTypeKind.Single: case EdmPrimitiveTypeKind.Stream: return(new EdmPrimitiveTypeReference(primitiveDefinition, type.IsNullable)); case EdmPrimitiveTypeKind.Binary: return(type.AsBinary()); case EdmPrimitiveTypeKind.Decimal: return(type.AsDecimal()); case EdmPrimitiveTypeKind.String: return(type.AsString()); case EdmPrimitiveTypeKind.Duration: case EdmPrimitiveTypeKind.DateTimeOffset: return(type.AsTemporal()); case EdmPrimitiveTypeKind.Geography: case EdmPrimitiveTypeKind.GeographyPoint: case EdmPrimitiveTypeKind.GeographyLineString: case EdmPrimitiveTypeKind.GeographyPolygon: case EdmPrimitiveTypeKind.GeographyCollection: case EdmPrimitiveTypeKind.GeographyMultiPolygon: case EdmPrimitiveTypeKind.GeographyMultiLineString: case EdmPrimitiveTypeKind.GeographyMultiPoint: case EdmPrimitiveTypeKind.Geometry: case EdmPrimitiveTypeKind.GeometryPoint: case EdmPrimitiveTypeKind.GeometryLineString: case EdmPrimitiveTypeKind.GeometryPolygon: case EdmPrimitiveTypeKind.GeometryCollection: case EdmPrimitiveTypeKind.GeometryMultiPolygon: case EdmPrimitiveTypeKind.GeometryMultiLineString: case EdmPrimitiveTypeKind.GeometryMultiPoint: return(type.AsSpatial()); case EdmPrimitiveTypeKind.None: break; } } } else if (typeDefinition.TypeKind == EdmTypeKind.TypeDefinition) { return(new EdmPrimitiveTypeReference(typeDefinition.UnderlyingType(), type.IsNullable)); } string typeFullName = type.FullName(); List <EdmError> errors = new List <EdmError>(type.Errors()); if (errors.Count == 0) { errors.AddRange(ConversionError(type.Location(), typeFullName, EdmConstants.Type_Primitive)); } return(new BadPrimitiveTypeReference(typeFullName, type.IsNullable, errors)); }
public BadEnumType(string qualifiedName, IEnumerable <EdmError> errors) : base(errors) { qualifiedName = qualifiedName ?? string.Empty; EdmUtil.TryGetNamespaceNameFromQualifiedName(qualifiedName, out this.namespaceName, out this.name); }
/// <summary> /// Initializes a new instance of the <see cref="EdmPathExpression"/> class. /// </summary> /// <param name="path">Path string containing segments separated by '/'. For example: "A.B/C/D.E/Func1(NS.T,NS.T2)/P1".</param> public EdmPathExpression(string path) { EdmUtil.CheckArgumentNull(path, "path"); this.path = path; }