-1

Odata expand always generate left join. And this causes not wanted data includes into result. models can be found below links

Querying DTOs based on EF using Odata

ExplicitExpansion() cause OData expand not work

  • You stated some information but I don't see a question. – Prolog Aug 22 '20 at 08:46
  • The qeestion is that, how make odata dont generate left join automatically. I need some times left join some times inner join. How can I make it with odata using automapper? – user3315759 Aug 23 '20 at 09:07

1 Answers1

0

OData protocol doesn't support JOIN Operation like SQL (Inner / Outer / Left /Right). Relationships are represented as so called "navigation" properties. If the data is backed by a SQL table, the exact and complex join needs to be defined on the server api.

You can also use $expand which is similar to a multiple join.

$expand generates left join even for optional foreign keys.

Left join (default)

URL: /odata/clientcontract?$expand=ContactsInfo

enter image description here

Inner join

URL: /odata/clientcontract?$expand=ContactsInfo&$filter=ContactsInfo/any()

enter image description here

Michael Wang
  • 3,782
  • 1
  • 5
  • 15