/// <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> /// 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> /// 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> /// 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); }
/// <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> /// 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); }
/// <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; }
/// <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(); }