Definition
Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Models Inheritance: System.ObjectSyntax
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
.ctor
Initializes a new instance of the EdmNavigationProperty class with the specified name and type.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the navigation property. |
type | string | The type of the navigation property. |
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when name or type is null or whitespace. |
.ctor Inherited
Inherited from
objectSyntax
Properties
ContainsTarget
Gets or sets a value indicating whether the navigation property contains dependent entities.Syntax
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
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
Property Value
Type:bool
true if the navigation property is required; otherwise, false.
Multiplicity
Gets the multiplicity of this navigation property.Syntax
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
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
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
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
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
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
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
Property Value
Type:string
The target entity type name without Collection() wrapper.
Type
Gets or sets the type of the navigation property.Syntax
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
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | 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
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | - |
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
GetHashCode Override
Returns a hash code for the current navigation property.Syntax
Returns
Type:int
A hash code for the current navigation property.
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ToString Override
Returns a string representation of the navigation property.Syntax
Returns
Type:string
A string containing the navigation property name and type.
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?