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.EdmNavigationProperty

Summary

Represents a navigation property in an OData entity type.

Remarks

Navigation properties define relationships between entity types, allowing traversal from one entity to related entities. They can represent both single-valued and collection-valued relationships.

Constructors

.ctor

Initializes a new instance of the EdmNavigationProperty class.

Syntax

public EdmNavigationProperty()

.ctor

Initializes a new instance of the EdmNavigationProperty class with the specified name and type.

Syntax

public EdmNavigationProperty(string name, string type)

Parameters

NameTypeDescription
namestringThe name of the navigation property.
typestringThe type of the navigation property.

Exceptions

ExceptionDescription
ArgumentExceptionThrown when name or type is null or whitespace.

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

ContainsTarget

Gets or sets a value indicating whether the navigation property contains dependent entities.

Syntax

public bool ContainsTarget { get; set; }

Property Value

Type: bool true if this navigation property contains dependent entities; otherwise, false.

Remarks

When true, this indicates that the target entities depend on the source entity for their existence. Deleting the source entity should cascade to delete the dependent entities.

IsCollection

Gets a value indicating whether this navigation property represents a collection.

Syntax

public bool IsCollection { get; }

Property Value

Type: bool true if the navigation property is collection-valued; otherwise, false.

IsRequired

Gets a value indicating whether the navigation property is required (non-nullable).

Syntax

public bool IsRequired { get; }

Property Value

Type: bool true if the navigation property is required; otherwise, false.

Multiplicity

Gets the multiplicity of this navigation property.

Syntax

public string Multiplicity { get; }

Property Value

Type: string A string indicating the relationship multiplicity.

Remarks

Returns “Many” for collection-valued properties, “One” for non-nullable single-valued properties, and “ZeroOrOne” for nullable single-valued properties.

Name

Gets or sets the name of the navigation property.

Syntax

public required string Name { get; set; }

Property Value

Type: string The navigation property name as defined in the CSDL metadata.

Nullable

Gets or sets a value indicating whether the navigation property can contain null values.

Syntax

public bool Nullable { get; set; }

Property Value

Type: bool true if the navigation property is nullable; otherwise, false.

Remarks

This property is typically relevant for to-one relationships. Collection-valued navigation properties are generally non-nullable (the collection itself, not its elements).

OnDelete

Gets or sets the on-delete action for this navigation property.

Syntax

public string OnDelete { get; set; }

Property Value

Type: string? The action to take when the target entity is deleted, or null if not specified.

Remarks

Common values include “Cascade” for cascading deletes and “SetNull” for setting the foreign key to null. The specific behavior depends on the underlying data store.

Partner

Gets or sets the name of the partner navigation property.

Syntax

public string Partner { get; set; }

Property Value

Type: string? The name of the corresponding navigation property on the target entity type, or null if not specified.

Remarks

The partner property represents the inverse side of a bidirectional relationship. For example, if Customer has Orders navigation property, Order might have a Customer partner property.

ReferentialConstraints

Gets or sets the referential constraints for this navigation property.

Syntax

public System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmReferentialConstraint> ReferentialConstraints { get; set; }

Property Value

Type: System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmReferentialConstraint> A collection of referential constraints that define the foreign key relationships.

Remarks

Referential constraints specify how the navigation property relates to properties in the source and target entity types, effectively defining foreign key relationships.

TargetType

Gets the target entity type name.

Syntax

public string TargetType { get; }

Property Value

Type: string The fully qualified name of the target entity type.

Remarks

For collection-valued navigation properties, this returns the element type within the Collection(). For single-valued properties, this returns the type directly.

TargetTypeName

Gets the target type name of the navigation property.

Syntax

public string TargetTypeName { get; }

Property Value

Type: string The target entity type name without Collection() wrapper.

Type

Gets or sets the type of the navigation property.

Syntax

public required string Type { get; set; }

Property Value

Type: string The target entity type, optionally wrapped in Collection() for to-many relationships.

Methods

Equals Override

Determines whether the specified object is equal to the current navigation property.

Syntax

public override bool Equals(object obj)

Parameters

NameTypeDescription
objobject?The object to compare with the current navigation property.

Returns

Type: bool true if the specified object is equal to the current navigation property; 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 navigation property.

Syntax

public override int GetHashCode()

Returns

Type: int A hash code for the current navigation property.

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 navigation property.

Syntax

public override string ToString()

Returns

Type: string A string containing the navigation property name and type.

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?