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

Summary

Represents a complex type in an OData model.

Remarks

Complex types are structured types that consist of a set of properties but do not have a key. They are used to define reusable data structures that can be used as property types in entity types or other complex types. Complex types cannot exist independently; they must be contained within an entity or another complex type.

Constructors

.ctor

Initializes a new instance of the EdmComplexType class.

Syntax

public EdmComplexType()

.ctor

Initializes a new instance of the EdmComplexType class with the specified name and namespace.

Syntax

public EdmComplexType(string name, string namespace)

Parameters

NameTypeDescription
namestringThe name of the complex type.
namespacestringThe namespace of the complex type.

Exceptions

ExceptionDescription
ArgumentExceptionThrown when name or namespace is null or whitespace.

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

Abstract

Gets or sets a value indicating whether this complex type is abstract.

Syntax

public bool Abstract { get; set; }

Property Value

Type: bool true if the complex type is abstract; otherwise, false.

Remarks

Abstract complex types cannot be instantiated directly but can serve as base types for other complex types. They are useful for defining common properties and behaviors.

BaseType

Gets or sets the base type of the complex type.

Syntax

public string BaseType { get; set; }

Property Value

Type: string? The fully qualified name of the base complex type, or null if this type has no base type.

Remarks

When specified, this complex type inherits all properties from the base type. The inheritance hierarchy must be consistent within the model.

FullName

Gets the fully qualified name of the complex type.

Syntax

public string FullName { get; }

Property Value

Type: string The namespace and name combined with a dot separator.

HasBaseType

Gets a value indicating whether this complex type inherits from another complex type.

Syntax

public bool HasBaseType { get; }

Property Value

Type: bool true if the complex type has a base type; otherwise, false.

HasNavigationProperties

Gets a value indicating whether this complex type has any navigation properties.

Syntax

public bool HasNavigationProperties { get; }

Property Value

Type: bool true if the complex type has navigation properties; otherwise, false.

IsAbstract

Gets a value indicating whether this complex type is abstract.

Syntax

public bool IsAbstract { get; }

Property Value

Type: bool true if the complex type is abstract; otherwise, false.

Remarks

This is an alias for the EdmComplexType.Abstract property for compatibility.

Name

Gets or sets the name of the complex type.

Syntax

public required string Name { get; set; }

Property Value

Type: string The local name of the complex type within its namespace.

Namespace

Gets or sets the namespace of the complex type.

Syntax

public required string Namespace { get; set; }

Property Value

Type: string The namespace that contains this complex type. Gets or sets the navigation properties of the complex type.

Syntax

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

Property Value

Type: System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmNavigationProperty> A collection of navigation properties that define relationships to entities.

Remarks

Navigation properties in complex types enable navigation from the complex type to related entities, but the complex type itself cannot be the target of navigation.

OpenType

Gets or sets a value indicating whether this complex type is open.

Syntax

public bool OpenType { get; set; }

Property Value

Type: bool true if the complex type is open; otherwise, false.

Remarks

Open complex types allow additional properties beyond those explicitly defined in the metadata. This provides flexibility for dynamic scenarios where the complete structure may not be known at design time.

Properties

Gets or sets the properties of the complex type.

Syntax

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

Property Value

Type: System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmProperty> A collection of structural properties that define the data elements of the complex type.

Remarks

These properties represent the data that can be stored and retrieved for instances of this complex type. Unlike entity types, complex types do not have key properties.

Methods

Equals Override

Determines whether the specified object is equal to the current complex type.

Syntax

public override bool Equals(object obj)

Parameters

NameTypeDescription
objobject?The object to compare with the current complex type.

Returns

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

Syntax

public override int GetHashCode()

Returns

Type: int A hash code for the current complex type.

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetNavigationProperty

Gets a navigation property by name.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmNavigationProperty GetNavigationProperty(string propertyName)

Parameters

NameTypeDescription
propertyNamestringThe name of the navigation property to retrieve.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmNavigationProperty? The navigation property with the specified name, or null if not found.

GetProperty

Gets a property by name.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmProperty GetProperty(string propertyName)

Parameters

NameTypeDescription
propertyNamestringThe name of the property to retrieve.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmProperty? The property with the specified name, or null if not found.

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

HasNavigationProperty

Determines whether the complex type has a navigation property with the specified name.

Syntax

public bool HasNavigationProperty(string propertyName)

Parameters

NameTypeDescription
propertyNamestringThe name of the navigation property to check.

Returns

Type: bool true if the complex type has the navigation property; otherwise, false.

HasProperty

Determines whether the complex type has a property with the specified name.

Syntax

public bool HasProperty(string propertyName)

Parameters

NameTypeDescription
propertyNamestringThe name of the property to check.

Returns

Type: bool true if the complex type has the property; otherwise, false.

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 complex type.

Syntax

public override string ToString()

Returns

Type: string The fully qualified name of the complex type.

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?