Skip to content
ArnaudB88 edited this page Feb 13, 2025 · 5 revisions

This project was founded to allow usage of OData filter text expressions in LINQ without ASP.NET Web API dependency.

The repository is forked from the official Asp.Net Core OData repo available at https://github.com/OData/AspNetCoreOData. The added extention methods come from the original Comminity.OData.Linq library (by IharYakimush). A big thanks to Ihar! Since that repository is abandoned, I started this project so the same functionality is available with OData v8+ libraries

Repository content

  • src/OData2Linq: a project with extension methods providing the OData to linq functionality. The project references the Microsoft.AspNetCore.OData project ánd includes that dll inside the nuget package. The reason for this can be read below.
  • test/OData2Linq.Tests: unit test project for the extension methods
  • test/OData2Linq.Benchmark: project testing the performance of the extension methods. The outcome can be found in Performance wiki page
  • all other files: forked from the Microsoft.AspNetCore.OData repository

Design choise

Since the extension methods for linq need some internal Microsoft OData classes/methods/properties, there are 3 different ways how this repository could be constructed:

  1. Create a project for the extension methods and all needed Microsoft classes (which could be copied from MS.AspNetCore.Odata). This is how the Comminity.OData.Linq library library was created. The downside is maintainability because with every MS OData lib update, functionality of the copied classes could change and give merge conflicts.
  2. Create a fork from the original MS repository and add the extension methods to the original MS.AspNetCore.OData project. This is easier to maintain as (1) but still project modifications are needed to create the OData2Linq nuget package. It's also less visible what is original MS code and what is added OData2Linq code. There is still a posibility of merge conflicts when the current repository is synced from the original one.
  3. Create a fork from the original MS repository and add the extension methods in a separate project. Because those methods need internal MS classes, the separate project is marked as a 'friend assembly'. The advantage is that no original files from the forked repository are changed (except AssemblyInfo.cs), so it's not possible to have merge conflicts when syncing the current repository with the original one. This option is used for OData2Linq.

Since the OData2Linq project references the MS.AspNetCore.OData project (modified with friend assembly), that MS project dll needs to be included in the nuget package (instead of linked with PackageReference). When installing the nuget, you will see the Microsoft.AspNetCore.OData.dll in your bin folder which is identical to the nuget version of it.

Clone this wiki locally