Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MsSql = "Could not be translated", utests with InMemoryDatabase pass #18695

Closed
generik0 opened this issue Nov 1, 2019 · 8 comments
Closed

MsSql = "Could not be translated", utests with InMemoryDatabase pass #18695

generik0 opened this issue Nov 1, 2019 · 8 comments
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported

Comments

@generik0
Copy link

generik0 commented Nov 1, 2019

Hi

I am a little worried about some matters in EF Core 3.0

I have a pile of repository pattern tests. All using the InMemoryDatabase. They are passing.
However the "real code" using a MsSql connections throw exceptions.
I.e. Issue with linq:

  • Contains
  • CompareTo
  • Any

Housten (or should I write Redmond), do we have a problem?

image

@generik0
Copy link
Author

generik0 commented Nov 1, 2019

Is there maybe an way I can add an event to my uTests, that all queries trigger a ToSql check?

@generik0
Copy link
Author

generik0 commented Nov 1, 2019

The ".Equals(s, StringComparison.OrdinalIgnoreCase)" alos passes with in mem, but not for mssql

image

@generik0
Copy link
Author

generik0 commented Nov 1, 2019

Hmm. I tried adding the DbCommandInterceptor, did not breakpoint on any of the overrides... But it is also in the relational namespace..

@smitpatel
Copy link
Member

@generik0 - The first query seems like duplicate of #17342, we have fixed that for 3.1 release.
The second query - string equals method with StringComparison argument was never translated in EF Core. See #1222 which is tracking it and discussion why it is not easy to do. It was being evaluated in previous versions of EF, now it is throwing exception as EF Core 3.0 does not allow client evaluation.

@generik0
Copy link
Author

generik0 commented Nov 1, 2019

HI @smitpatel . Thanks for answering! :-)

My point is not that EF Core 3.0 is failing for MS. That is what it is.

My point is that the Memory Db, is not falling for the queries that the real db is failing for.....

How can I use the Memory Db for testing, if we can not trust it behaves the same way when we query? 😨

In other words. if the memory db is to be used for testing, e.g. repos (which it was previously perfect for), then it should really fail here also...

Hence I have tried to add a question/be proactive: Van one add an interrupt (or something), that tests converting the memory db queries into a generic sql or something, so we can catch exceptions for the translations?

@generik0
Copy link
Author

generik0 commented Nov 1, 2019

Again, if the mssql ef core LINQ fails for translations, the memory really also should too.. Otherwise, test with the memory db has no value at all... :-/
Does it make sense what I am trying to convey here?

@ajcvickers
Copy link
Member

How can I use the Memory Db for testing, if we can not trust it behaves the same way when we query?

You can't. See the discussion here: #18457

@generik0
Copy link
Author

generik0 commented Nov 1, 2019

@ajcvickers, oh, that is bad new. The InMemeroy Db rocked.. And a clear advantage when using the repo pattern and TDDing / integration tests...

@generik0 generik0 closed this as completed Nov 1, 2019
@ajcvickers ajcvickers added closed-no-further-action The issue is closed and no further action is planned. and removed type-bug labels Nov 1, 2019
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported
Projects
None yet
Development

No branches or pull requests

3 participants