Microsoft.OData.Edm 8.2.4

Microsoft.OData.Edm

The Microsoft.OData.Edm library provides APIs to build, parse, and validate Entity Data Model (EDM) that conform to the OData protocol. It is a core component of the OData .NET libraries, enabling you to work with OData metadata.

Think of it as the schema that describes the kind of data your service exposes. The Microsoft.OData.Edm library, also known as EdmLib, provides classes and interfaces for working with OData models. It includes classes for reading/parsing a schema file in CSDL in XML or JSON formats, writing such files (CsdlReader and CsdlWriter), as well as creating a model directly in-memory (EdmModel).

The IEdmModel interface is used extensively across OData libraries as it provides the base layer for retrieving information about the types and functionality exposed by an OData service.

The EdmModel class (which implements the IEdmModel interface) allows you to manually create a model/schema in memory.

Installation

You can install the Microsoft.OData.Edm package via NuGet:

dotnet add package Microsoft.OData.Edm

Or via the NuGet Package Manager Console:

Install-Package Microsoft.OData.Edm

Getting Started

Creating an EDM Model

Here's a simple example of how to create an EDM model using Microsoft.OData.Edm:

using Microsoft.OData.Edm;
using System;

namespace EdmLibSample;

public class SampleModelBuilder
{
    public static IEdmModel GetEdmModel()
    {
        // Create an empty model
        var model = new EdmModel();

        // Define an entity type
        var productType = new EdmEntityType("NS", "Product");
        productType.AddKeys(productType.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32));
        productType.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
        model.AddElement(productType);

        // Define an entity container
        var container = new EdmEntityContainer("NS", "Container");
        model.AddElement(container);

        // Define an entity set
        var products = container.AddEntitySet("Products", productType);

        // Output the model
        Console.WriteLine("EDM Model created successfully.");

        return model;
    }
}

Parsing an EDM Model

You can also parse an EDM model from a CSDL (Common Schema Definition Language) document:

using Microsoft.OData.Edm.Csdl;
using Microsoft.OData.Edm;
using System.Xml;

string csdl = @"
<edmx:Edmx Version=""4.0"" xmlns:edmx=""http://docs.oasis-open.org/odata/ns/edmx"">
  <edmx:DataServices>
    <Schema Namespace=""NS"" xmlns=""http://docs.oasis-open.org/odata/ns/edm"">
        <EntityType Name='Product'>
            <Key>
                <PropertyRef Name='ID' />
            </Key>
            <Property Name='ID' Type='Edm.Int32' Nullable='false' />
            <Property Name='Name' Type='Edm.String' />
        </EntityType>
        <EntityContainer Name='Container'>
            <EntitySet Name='Products' EntityType='NS.Product' />
        </EntityContainer>
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>";

IEdmModel model;
using (var reader = XmlReader.Create(new StringReader(csdl)))
{
    model = CsdlReader.Parse(reader);
    Console.WriteLine("EDM Model parsed successfully.");
}

Documentation

For more detailed information, please refer to the official documentation.

Community

Contribution

There are many ways for you to contribute to OData .NET. The easiest way is to participate in discussion of features and issues. You can also contribute by sending pull requests of features or bug fixes to us. Contribution to the documentations is also highly welcomed. Please refer to the CONTRIBUTING.md for more details.

Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

5.3 Support

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Showing the top 20 packages that depend on Microsoft.OData.Edm.

Packages Downloads
Microsoft.AspNetCore.OData
This package contains everything you need to create OData v4.0 endpoints using ASP.NET Core MVC Core 3.x and 5.x to support OData query syntax for your Web APIs.
31
Microsoft.OData.Core
Classes to serialize, deserialize and validate OData JSON payloads. Supports OData v4 only. Enables construction of OData producers and consumers. Targets .NET Core 5, and .NET Portable Lib with support for .NET 4.0, SL 5.0, Win Phone 8, Win Phone 8.1, and Win 8. Localized for CHS, CHT, DEU, ESN, FRA, ITA, JPN, KOR and RUS. OData .NET library is open source at http://github.com/OData/odata.net
30
Microsoft.AspNetCore.OData
This package contains everything you need to create OData v4.0 endpoints using ASP.NET Core MVC Core 3.x and 5.x to support OData query syntax for your Web APIs.
30
Microsoft.OData.Core
Classes to serialize, deserialize and validate OData JSON payloads. Supports OData v4 only. Enables construction of OData producers and consumers. Targets .NET Core 5, and .NET Portable Lib with support for .NET 4.0, SL 5.0, Win Phone 8, Win Phone 8.1, and Win 8. Localized for CHS, CHT, DEU, ESN, FRA, ITA, JPN, KOR and RUS. OData .NET library is open source at http://github.com/OData/odata.net
29
Microsoft.OData.Core
Classes to serialize, deserialize and validate OData JSON payloads. Supports OData v4 only. Enables construction of OData producers and consumers. Targets .NET Portable Lib with support for .NET 4.0, SL 5.0, Win Phone 8, Win Phone 8.1, and Win 8. Localized for CHS, CHT, DEU, ESN, FRA, ITA, JPN, KOR and RUS. OData .NET library is open source at http://odata.codeplex.com
29
Microsoft.AspNetCore.OData
This package contains everything you need to create OData v4.0 endpoints using ASP.NET Core MVC Core 3.x and 5.x to support OData query syntax for your Web APIs.
29
Microsoft.AspNetCore.OData
This package contains everything you need to create OData v4.0 endpoints using ASP.NET Core MVC Core 3.x and 5.x to support OData query syntax for your Web APIs.
28
Microsoft.OData.Core
Classes to serialize, deserialize and validate OData JSON payloads. Supports OData v4 only. Enables construction of OData producers and consumers. Targets .NET Core 5, and .NET Portable Lib with support for .NET 4.0, SL 5.0, Win Phone 8, Win Phone 8.1, and Win 8. Localized for CHS, CHT, DEU, ESN, FRA, ITA, JPN, KOR and RUS. OData .NET library is open source at http://github.com/OData/odata.net
28
Microsoft.OData.Core
Classes to serialize, deserialize and validate OData JSON payloads. Supports OData v4. Enables construction of OData services and clients. Targets .NET Platform Standard 1.1. OData .NET library is open source at http://github.com/OData/odata.net. Documentation for the library can be found at https://docs.microsoft.com/en-us/odata/.
28
Microsoft.OData.Core
Classes to serialize, deserialize and validate OData JSON payloads. Supports OData v4. Enables construction of OData services and clients. Targets .NET Platform Standard 1.1. OData .NET library is open source at http://github.com/OData/odata.net. Documentation for the library can be found at https://odata.github.io/odata.net.
27
Microsoft.OData.Core
Classes to serialize, deserialize and validate OData JSON payloads. Supports OData v4 only. Enables construction of OData producers and consumers. Targets .NET Core 5, and .NET Portable Lib with support for .NET 4.0, SL 5.0, Win Phone 8, Win Phone 8.1, and Win 8. Localized for CHS, CHT, DEU, ESN, FRA, ITA, JPN, KOR and RUS. OData .NET library is open source at http://github.com/OData/odata.net
27
Microsoft.OData.Core
Classes to serialize, deserialize and validate OData JSON payloads. Supports OData v4 only. Enables construction of OData services and clients. Targets .NET Platform Standard 1.1. Localized for CHS, CHT, DEU, ESN, FRA, ITA, JPN, KOR and RUS. OData .NET library is open source at http://github.com/OData/odata.net
27
Microsoft.OData.Core
Classes to serialize, deserialize and validate OData JSON payloads. Supports OData v4 only. Enables construction of OData producers and consumers. Targets .NET Portable Lib with support for .NET 4.0, SL 5.0, Win Phone 8, Win Phone 8.1, and Win 8. Localized for CHS, CHT, DEU, ESN, FRA, ITA, JPN, KOR and RUS. OData .NET library is open source at http://odata.codeplex.com
27
Microsoft.AspNetCore.OData
This package contains everything you need to create OData v4.0 endpoints using ASP.NET Core MVC Core 3.x and 5.x to support OData query syntax for your Web APIs.
27

https://learn.microsoft.com/en-us/odata/changelog/

Version Downloads Last updated
8.2.4 1 6/26/2025
8.2.3 21 12/18/2024
8.2.2 13 12/18/2024
8.2.1 11 12/18/2024
8.2.0 13 11/15/2024
8.1.0 12 11/18/2024
8.0.2 15 10/1/2024
8.0.1 15 8/21/2024
8.0.0 18 8/16/2024
8.0.0-rc.1 20 7/14/2024
8.0.0-preview.3 22 7/14/2024
8.0.0-preview.2 25 5/5/2024
8.0.0-preview.1 25 5/3/2024
7.21.7 0 6/23/2025
7.21.6 13 11/18/2024
7.21.5 19 11/10/2024
7.21.4 19 11/10/2024
7.21.3 21 8/19/2024
7.21.2 19 6/26/2024
7.21.1 26 5/4/2024
7.21.0 25 5/3/2024
7.20.0 20 3/5/2024
7.19.0 28 3/5/2024
7.18.0 26 3/5/2024
7.17.0 22 3/5/2024
7.16.0 24 3/5/2024
7.15.0 22 3/5/2024
7.14.1 22 3/5/2024
7.14.0 20 3/5/2024
7.13.0 24 3/5/2024
7.12.5 23 3/5/2024
7.12.4 26 3/5/2024
7.12.3 22 3/5/2024
7.12.2 21 3/5/2024
7.12.1 22 3/5/2024
7.12.0 21 3/5/2024
7.11.1 25 3/5/2024
7.10.0 24 3/5/2024
7.9.4 21 3/5/2024
7.9.3 25 3/5/2024
7.9.2 23 3/5/2024
7.9.1 24 3/5/2024
7.9.0 20 3/5/2024
7.8.3 23 3/5/2024
7.8.2 22 3/5/2024
7.8.1 24 3/5/2024
7.7.3 21 3/5/2024
7.7.2 21 3/5/2024
7.7.1 24 4/12/2022
7.7.0 22 3/5/2024
7.7.0-beta 21 3/5/2024
7.6.4 25 3/5/2024
7.6.3 18 3/5/2024
7.6.2 21 3/5/2024
7.6.1 24 3/5/2024
7.6.1-beta 18 3/5/2024
7.6.0 21 3/5/2024
7.6.0-beta 21 3/5/2024
7.5.4 24 3/5/2024
7.5.3 20 3/5/2024
7.5.2 19 3/5/2024
7.5.1 23 3/5/2024
7.5.0 20 3/5/2024
7.4.4 21 3/5/2024
7.4.3 23 3/5/2024
7.4.1 19 3/5/2024
7.4.0 22 3/5/2024
7.4.0-beta3 24 3/8/2024
7.4.0-beta2 21 3/8/2024
7.4.0-beta 25 3/5/2024
7.3.1 25 3/5/2024
7.3.0 23 3/5/2024
7.3.0-beta 21 3/5/2024
7.2.0 23 3/5/2024
7.1.1 19 3/5/2024
7.0.0 20 3/5/2024
7.0.0-beta 22 3/5/2024
6.19.0 22 3/5/2024
6.18.0 24 3/5/2024
6.18.0-beta 22 3/8/2024
6.17.0 24 3/5/2024
6.16.0 26 3/5/2024
6.16.0-beta 25 3/8/2024
6.15.0 28 3/5/2024
6.15.0-beta 24 3/8/2024
6.14.0 25 3/5/2024
6.14.0-rc2 23 3/5/2024
6.14.0-rc 25 3/5/2024
6.14.0-beta 22 3/8/2024
6.13.0 21 3/5/2024
6.13.0-rc 23 3/5/2024
6.13.0-beta 23 3/8/2024
6.12.0 25 3/5/2024
6.12.0-beta 23 3/8/2024
6.11.0 26 3/5/2024
6.10.0 26 3/5/2024
6.9.0 20 3/5/2024
6.8.1 20 3/5/2024
6.8.0 19 3/5/2024
6.7.0 20 3/5/2024
6.6.0 24 3/5/2024
6.5.0 23 3/5/2024
6.4.0 20 3/5/2024
6.3.0 22 3/5/2024
6.2.0 21 3/5/2024
6.1.0 20 3/5/2024
6.0.0 21 3/5/2024
6.0.0-beta1 22 3/8/2024
6.0.0-alpha2 24 3/5/2024
6.0.0-alpha1 24 3/5/2024