Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Models Inheritance: System.Object

Syntax

Microsoft.OData.Mcp.Core.Models.EdmReferentialConstraint

Summary

Represents a referential constraint that defines the relationship between properties in a navigation property.

Remarks

Referential constraints specify how foreign key relationships work in OData, mapping properties from the source entity to properties in the target entity. They are analogous to foreign key constraints in relational databases.

Constructors

.ctor

Initializes a new instance of the EdmReferentialConstraint class.

Syntax

public EdmReferentialConstraint()

.ctor

Initializes a new instance of the EdmReferentialConstraint class with the specified property names.

Syntax

public EdmReferentialConstraint(string property, string referencedProperty)

Parameters

NameTypeDescription
propertystringThe name of the property in the source entity type.
referencedPropertystringThe name of the referenced property in the target entity type.

Exceptions

ExceptionDescription
ArgumentExceptionThrown when property or referencedProperty is null or whitespace.

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

Property

Gets or sets the name of the property in the source entity type.

Syntax

public required string Property { get; set; }

Property Value

Type: string The name of the property that acts as the foreign key in the source entity.

Remarks

This property references a property in the entity type that contains the navigation property.

ReferencedProperty

Gets or sets the name of the referenced property in the target entity type.

Syntax

public required string ReferencedProperty { get; set; }

Property Value

Type: string The name of the property in the target entity that is referenced by the foreign key.

Remarks

This is typically a key property in the target entity type. The relationship is established by matching the value of the Property with the ReferencedProperty.

Methods

Equals Override

Determines whether the specified object is equal to the current referential constraint.

Syntax

public override bool Equals(object obj)

Parameters

NameTypeDescription
objobject?The object to compare with the current referential constraint.

Returns

Type: bool true if the specified object is equal to the current referential constraint; otherwise, false.

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Override

Returns a hash code for the current referential constraint.

Syntax

public override int GetHashCode()

Returns

Type: int A hash code for the current referential constraint.

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Override

Returns a string representation of the referential constraint.

Syntax

public override string ToString()

Returns

Type: string A string showing the property mapping relationship.

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?