Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Parsing

Syntax

Microsoft.OData.Mcp.Core.Parsing.ICsdlMetadataParser

Summary

Interface for parsing OData CSDL (Conceptual Schema Definition Language) XML documents into EDM models.

Remarks

This interface abstracts the parsing of CSDL XML documents that describe the structure of OData services, including entity types, complex types, entity containers, and their relationships. It supports OData specification versions 4.0 and later.

Methods

ParseFromFile Abstract

Parses a CSDL XML document from a file.

Syntax

Microsoft.OData.Mcp.Core.Models.EdmModel ParseFromFile(string filePath)

Parameters

NameTypeDescription
filePathstringThe path to the file containing the CSDL XML content.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmModel The parsed EDM model.

Exceptions

ExceptionDescription
ArgumentExceptionThrown when filePath is null or whitespace.
FileNotFoundExceptionThrown when the file does not exist.
XmlExceptionThrown when the XML is malformed.
InvalidOperationExceptionThrown when the CSDL structure is invalid.

ParseFromStream Abstract

Parses a CSDL XML document from a stream.

Syntax

Microsoft.OData.Mcp.Core.Models.EdmModel ParseFromStream(System.IO.Stream stream)

Parameters

NameTypeDescription
streamSystem.IO.StreamThe stream containing the CSDL XML content.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmModel The parsed EDM model.

Exceptions

ExceptionDescription
ArgumentNullExceptionThrown when stream is null.
XmlExceptionThrown when the XML is malformed.
InvalidOperationExceptionThrown when the CSDL structure is invalid.

ParseFromString Abstract

Parses a CSDL XML document from a string.

Syntax

Microsoft.OData.Mcp.Core.Models.EdmModel ParseFromString(string csdlXml)

Parameters

NameTypeDescription
csdlXmlstringThe CSDL XML content as a string.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmModel The parsed EDM model.

Exceptions

ExceptionDescription
ArgumentExceptionThrown when csdlXml is null or whitespace.
XmlExceptionThrown when the XML is malformed.
InvalidOperationExceptionThrown when the CSDL structure is invalid.