-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Solution of Compute - Include - Decompile problem #53
Conversation
@daveaglick @JonPSmith can you guys take a look? |
As I wrote the test harness then my comment is that Pavel's test does not follow the normal conventions. The test harness expects a test to a) run the test with LINQ without DelegateDecompiler (DD) to prove that it is possible and then b) run the same test, but using DD. This approach stops us chasing problems in DD which are really EF problems. There are plenty of examples to follow, e.g. Select Tests Pavel.Mayorov's tests may be useful to him, but because they do not use the test harness its results won't be added to the automatically generated text documentation. As to the fix then I will let @daveaglick comment on that :) |
Ok, let me explain my test case. Look at this code:
This code works as expected but does not load children. Let's try to add
This code works but i cannot use this sequence in my project because of reasons. This code
does not throw any exception but does not work as expected due to #38. The readme says: "Decompile method should be called after all ORM specific methods, otherwise it may not work". Ok, let's move
Oops, now we got an exception. So, now readme has the mistake, right sentence is "Decompile method or any methods that references computed properties or functions should be called after all ORM specific methods, otherwise it may not work". In my pull request i try to fix behavior according to current version of documentation. |
PS ComputeDoubleIncludeDecompileNotFail is just a test of recursion. |
I'll try and take a look at this tomorrow - I'm swamped today. |
First off, I'm sure I speak for @hazzik when I say thanks for the PR! I'd like to drop some reference information in here. I got curious what was really going on (why the heck are we getting a
Notice that it (indirectly) returns an As for the code, it looks fine to me. The tests need some cleanup to use the harness that @JonPSmith developed, but I don't mind taking care of that after this is merged. FYI - this should also resolve #38. I'll add some additional tests for TL;DR: |
No, this changes cannot resolve #38. Because EF use this code for third-party IQueryable providers:
If |
@mayorovp can you change the test to use @JonPSmith framework? |
@mayorovp Okay, I think I get what you're saying. This PR does fix the problem with crashing, but because we've wrapped the EF query provider by calling I'm not sure this is the case, though. I ran your Notice how when we evaluate the |
Sorry, i misunderstood #38 because it was just a link to some comment in other PR. Yes, my changes resolves this issue:
|
@mayorovp can you create test for |
Any hope in getting this merged in? |
@txavier if someone [re]write tests... |
Can you please enable Allow edits from maintainers option on this PR? |
@hazzik enabled |
anyone please have news? |
Issue #52
Added
VisitConstant
method toDecompileExpressionVisitor
class. If constant isIQueryable
it value's expression should be visited.Added some logic to avoid infinite recursion (because EF
DbSet
expression is avalue(ObjectQuery<...>).MergeAs(AppendData)
where first constant is a internalDbSet
query itself with same expression in).Добавил метод
VisitConstant
в классDecompileExpressionVisitor
. Если константа являетсяIQueryable
- выражение, хранящееся в ее значении, также будет преобразовано.Также добавил логику, необходимую для того, чтобы избежать вечной рекурсии. Это необходимо, потому что выражение, содержащееся в
DbSet
, определяется какvalue(ObjectQuery<...>).MergeAs(AppendData)
, где первая константа - это внутренний запрос самогоDbSet
, с точно таким же выражением внутри.