AspNetCoreOData icon indicating copy to clipboard operation
AspNetCoreOData copied to clipboard

LINQ2DB support

Open aboryczko opened this issue 2 years ago • 4 comments

Hi, Would it be possible to improve LINQ2DB support? I've noticed that most of my problems came from null propagation handling. The HandleNullPropagationOptionHelper has some hardcoded namespaces for Microsoft DB libraries, are there some special conditions that need to be met to "certify" LINQ2DB to add it there? I feel that a lot of people that have tried LINQ2DB were unable to get to the bottom of why they received errors. I know that the workaround is to set [EnableQuery(HandleNullPropagation = HandleNullPropagationOption.False)], but it's not easy to find.

aboryczko avatar Apr 02 '22 07:04 aboryczko

Asking for support for "library X" seems like the wrong way to go about this. Wouldn't it be best to "make it provider-agnostic" instead, working only with the IQueryable interface?

julealgon avatar Apr 04 '22 16:04 julealgon

It would be nice, but I imagine that would take a lot of effort. I'd be OK with something as simple as adding an option in Startup that makes provider X handle null propagation as I see fit.

aboryczko avatar Apr 05 '22 06:04 aboryczko

@aboryczko We can look at improving the error message if we're able to identify this error case. We can also see about making it possible to configure the HandleNullPropagation setting from Startup. We welcome pull request contribution if you're in a position to contribute

gathogojr avatar Apr 05 '22 16:04 gathogojr

@gathogojr as far as I understand the idea is that the in-memory provider needs to have null handling done by the library, but the database ones usually do it on their own and setting this globaly might break it if someone exposes an in-memory IQueryable. Doing a hard default during startup would break this, right? If this is not the case I could do something simple within DefaultQuerySettings to set this.

aboryczko avatar Apr 06 '22 07:04 aboryczko