Skip to main content

Definition

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

Syntax

Summary

Represents a property in an OData entity type or complex type.

Remarks

Properties define the structure and data characteristics of entity types and complex types. They specify the name, type, and various constraints of the data elements.

Constructors

.ctor

Initializes a new instance of the EdmProperty class.

Syntax

.ctor

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

Syntax

Parameters

Exceptions

.ctor Inherited

Inherited from object

Syntax

Properties

DefaultValue

Gets or sets the default value of the property.

Syntax

Property Value

Type: string? The default value as a string, or null if not specified.

Remarks

The default value is represented as it appears in the CSDL metadata. Type-specific parsing is required when using this value.

Description

Gets or sets the description of the property.

Syntax

Property Value

Type: string? A human-readable description of the property’s purpose.

ElementType

Gets the element type for collection properties.

Syntax

Property Value

Type: string The element type of the collection, or the type itself if not a collection.

HasDefaultValue

Gets a value indicating whether the property has a default value.

Syntax

Property Value

Type: bool true if the property has a default value; otherwise, false.

IsCollection

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

Syntax

Property Value

Type: bool true if the property type is a collection; otherwise, false.

IsKey

Gets or sets a value indicating whether this property is part of the entity key.

Syntax

Property Value

Type: bool true if the property is a key property; otherwise, false.

Remarks

Key properties uniquely identify an entity instance and are typically non-nullable.

IsNullable

Gets a value indicating whether the property is nullable (alias for Nullable property).

Syntax

Property Value

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

IsPrimitive

Gets a value indicating whether this property represents a primitive type.

Syntax

Property Value

Type: bool true if the property type is an EDM primitive type; otherwise, false.

MaxLength

Gets or sets the maximum length of the property value.

Syntax

Property Value

Type: System.Nullable<int> The maximum length, or null if not specified.

Remarks

This constraint applies primarily to string and binary properties. A value of “Max” in the metadata is represented as null here.

Name

Gets or sets the name of the property.

Syntax

Property Value

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

Nullable

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

Syntax

Property Value

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

Remarks

When not specified in the metadata, this property defaults to true for most types, except for key properties which are typically non-nullable.

Precision

Gets or sets the precision of the property value.

Syntax

Property Value

Type: System.Nullable<int> The precision, or null if not specified.

Remarks

Precision applies to decimal and temporal types, indicating the total number of digits.

Scale

Gets or sets the scale of the property value.

Syntax

Property Value

Type: System.Nullable<int> The scale, or null if not specified.

Remarks

Scale applies to decimal types, indicating the number of digits after the decimal point. A value of “Variable” in the metadata is represented as null here.

SRID

Gets or sets the SRID (Spatial Reference System Identifier) for spatial properties.

Syntax

Property Value

Type: string? The SRID value, or null if not applicable or not specified.

Remarks

This property is relevant only for geography and geometry types.

Type

Gets or sets the type of the property.

Syntax

Property Value

Type: string The fully qualified type name (e.g., “Edm.String”, “Namespace.EntityType”).

TypeName

Gets the type name of the property (alias for Type property).

Syntax

Property Value

Type: string The fully qualified type name (e.g., “Edm.String”, “Namespace.EntityType”).

Unicode

Gets or sets a value indicating whether the property uses Unicode encoding.

Syntax

Property Value

Type: System.Nullable<bool> true if Unicode is enabled; false if disabled; null if not specified.

Remarks

This property applies to string properties and affects how the data is stored and transmitted.

Methods

Equals Override

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

Syntax

Parameters

Returns

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

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

GetHashCode Override

Returns a hash code for the current property.

Syntax

Returns

Type: int A hash code for the current property.

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

ToString Override

Returns a string representation of the property.

Syntax

Returns

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

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?