Skip to content

GabrieleVolpato/ODataFlatteningError

Repository files navigation

ODataFlatteningError

This repository is meant to show a problem involving OData, Automapper and EntityFrameworkCore when flattening a database one to many relations into a one to one relation for DTO classes.

With this scenario, it's impossible to query DTOs child entity without breaking OData response.

How to

Just clone this repository and launch the project. Try to make this HTTP request and see the broken response:

/api/parents?$expand=Child&$filter=Id eq 4 or Child/Id eq 4

The problem

Multiple problems are to be found here:

  • The LinqToSql query generated by OData cannot be converted to SQL.
  • OData startes the response streaming before the database access, and this leads to a broken output (it should break with an exception). See this image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages