> ## Documentation Index
> Fetch the complete documentation index at: https://ai.easyaf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CsdlParser

> Parses OData CSDL (Conceptual Schema Definition Language) XML documents into EDM models.

## Definition

**Assembly:** Microsoft.OData.Mcp.Core.dll

**Namespace:** Microsoft.OData.Mcp.Core.Parsing

**Inheritance:** System.Object

## Syntax

```csharp theme={null}
Microsoft.OData.Mcp.Core.Parsing.CsdlParser
```

## Summary

Parses OData CSDL (Conceptual Schema Definition Language) XML documents into EDM models.

## Remarks

This parser handles 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.

## Constructors

### &#x20;.ctor

Initializes a new instance of the [CsdlParser](https://ai.easyaf.dev/odata-mcp/api-reference/Microsoft/OData/Mcp/Core/Parsing/CsdlParser.md) class.

#### Syntax

```csharp theme={null}
public CsdlParser()
```

### &#x20;.ctor

Initializes a new instance of the [CsdlParser](https://ai.easyaf.dev/odata-mcp/api-reference/Microsoft/OData/Mcp/Core/Parsing/CsdlParser.md) class with the specified logger.

#### Syntax

```csharp theme={null}
public CsdlParser(Microsoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Parsing.CsdlParser> logger)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `logger` | `Microsoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Parsing.CsdlParser>` | The logger to use for diagnostic messages. |

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public Object()
```

## Methods

### &#x20;Equals Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual bool Equals(object obj)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `obj` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;Equals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;GetHashCode Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### &#x20;GetType Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### &#x20;MemberwiseClone Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### &#x20;ParseFromFile

Parses a CSDL XML document from a file.

#### Syntax

```csharp theme={null}
public Microsoft.OData.Mcp.Core.Models.EdmModel ParseFromFile(string filePath)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `filePath` | `string` | The path to the file containing the CSDL XML content. |

#### Returns

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

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentException` | Thrown when *filePath* is null or whitespace. |
| `FileNotFoundException` | Thrown when the file does not exist. |
| `XmlException` | Thrown when the XML is malformed. |
| `InvalidOperationException` | Thrown when the CSDL structure is invalid. |

### &#x20;ParseFromStream

Parses a CSDL XML document from a stream.

#### Syntax

```csharp theme={null}
public Microsoft.OData.Mcp.Core.Models.EdmModel ParseFromStream(System.IO.Stream stream)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `stream` | `System.IO.Stream` | The stream containing the CSDL XML content. |

#### Returns

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

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentNullException` | Thrown when *stream* is null. |
| `XmlException` | Thrown when the XML is malformed. |
| `InvalidOperationException` | Thrown when the CSDL structure is invalid. |

### &#x20;ParseFromString

Parses a CSDL XML document from a string.

#### Syntax

```csharp theme={null}
public Microsoft.OData.Mcp.Core.Models.EdmModel ParseFromString(string csdlXml)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `csdlXml` | `string` | The CSDL XML content as a string. |

#### Returns

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

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentException` | Thrown when *csdlXml* is null or whitespace. |
| `XmlException` | Thrown when the XML is malformed. |
| `InvalidOperationException` | Thrown when the CSDL structure is invalid. |

### &#x20;ReferenceEquals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;ToString Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual string ToString()
```

#### Returns

Type: `string?`

## Related APIs

* Microsoft.OData.Mcp.Core.Parsing.ICsdlMetadataParser


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.