-
-
Notifications
You must be signed in to change notification settings - Fork 158
Fix sparse fields with DefaultEntityRepository.Get() override #476
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
Conversation
Thanks for the PR as always. This is a pretty big breaking change. I need to think about it a little more. We should be able to deprecate the existing Get API without causing a breaking change right away. But, I’d like to spend some more time understanding the problem. I know that we override this method in many places and haven’t run into this issue. I’m wondering if there is an issue here that needs to be pushed back onto EF? But anyways, I need to work on a minimum reproduction of the issue so I can understand it better. |
@jaredcnance To understand the problem, you can simply try this two use-cases in TodoItemRepository with basic query [GET] api/todo-items
b)
Only order of Select() and Where() is changed.
In b) everything is OK I think this is not EF Core issue, because every LINQ query (method or query syntax) should end with select clause. And if you modify example a) and add OwnerId to Select, than everything works as expected.
That was the reason I was talking about "reducing" properties -> Where() doesn't see property, which is not provided in previous Select() Is it more clear, now? |
@jaredcnance hey man, or you can try simply this (without any Repository Layer and overrides) [GET] api/todo-items?filter[ordinal]=1&fields[todo-items]=description The problem is same - applying filters and it's Where() method is called after Select() |
Yes, I see. You're correct. And I don't think moving the order alone should be a breaking change. I think we can probably use C# 8 default interface methods to keep this from being a breaking change entirely. Later this week I may put together a draft document that describes our approach and philosophy around these kinds of breaking changes so that users have clear expectations. But, other than that, this approach looks good to me. Thanks! |
@jaredcnance What about new GetQueryable() method like you mentioned here #404 (comment) ? This is breaking change only for those, who implements custom ResourceService by override (without base.GetAsync call) or implement IEntityReadRepository. They will see this deprecation with clear description. If developer let deprecation be, function is the same. If not he has to change to GetQueryable() and provide Select() row to his custom service. |
No, I like the idea. However, for the first rollout I think I would prefer to try using default interface methods and deprecation warnings. This lets us release it as a minor version first so users don’t have to fix all overrides in one go (some projects make heavy use of overrides and the work will take a while). But, overall, I like the proposal. 👍 |
Ok, no problem. But can you give me some explained guidance, where to put changes? Because I'm not familiar with default interface methods, yet. Right now I can't imagine the right approach. |
Sure. Tomorrow evening I’ll extend this PR with what I’m thinking if that’s alright |
Ok, thanks. |
Ah never mind, I was think that default interface methods were already available in the 3.0.0-preview SDK. But, apparently it's still at the proof-of-concept phase. So, let's bump the major version and we can release this as alpha. |
Yeah I see, never mind. Thanks for approval, but do you want to do it like this "first pass" way? What about deprecating Get() and introduce new GetQueryable() to minimize posible breaking changes? Just asking for sure |
@jaredcnance Can you look at the question above? This is quite blocking feature for my company at this moment and I don't know if I can realease as alpha... |
I think we should do this. We'll completely drop |
@milosloub see #498 |
Closes #475
Current implementation:
Requested implementation:
What do you think about this change?