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

Add support for including child collection objects #460

Open
kamranayub opened this Issue Jul 19, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@kamranayub
Copy link
Contributor

kamranayub commented Jul 19, 2016

For post-1.0, add support for allowing Include on child collection objects:

var items = new List<Item>();
session.Query<User>().Include(u => u.Collection.Select(c => c.ItemId), items);

@jeremydmiller jeremydmiller modified the milestone: 1.1 Sep 22, 2016

@jeremydmiller jeremydmiller modified the milestones: 1.1, 1.2 Oct 4, 2016

@jeremydmiller jeremydmiller modified the milestones: 1.2, 1.3 Oct 31, 2016

@jeremydmiller jeremydmiller modified the milestone: 1.3 Feb 8, 2017

@jokokko

This comment has been minimized.

Copy link
Collaborator

jokokko commented Apr 27, 2017

Maybe something like

SELECT * FROM public.mt_doc_issuelist as il
INNER JOIN public.mt_doc_issue i on (il.Data->'Issues') @> to_jsonb(t.Id)
-- or from Marten object serialization (in this case yielding equal execution plans)
SELECT * FROM public.mt_doc_issuelist as il
INNER JOIN public.mt_doc_issue i on (il.Data->'Issues') @> (t.Data->'Id')
public class IssueList
{
	public List<Guid> Issues { get; set; }
	...
}
query.Query<IssueList>().Include<Issue>(x => x.Issues, i => issuesFromDb.Add(i))

By quick glance, the current implementation of IncludeJoin does not seem to favour this, though.

jokokko added a commit to jokokko/marten that referenced this issue May 2, 2017

A way to handle JasperFx#460 using the @> operator. Does not use the …
…SqlLocator from IField as customizing that in JsonLocatorField would break SelectMany implementations :|

@jeremydmiller jeremydmiller modified the milestone: 2.0 May 6, 2017

@jeremydmiller jeremydmiller modified the milestones: 2.0, 2.1 Jun 8, 2017

@jeremydmiller jeremydmiller modified the milestone: 2.1 Aug 11, 2017

@jeremydmiller

This comment has been minimized.

Copy link
Contributor

jeremydmiller commented Jan 4, 2018

Maybe this would help do it in one call: https://tech.npras.in/postgres-recursive-query/

@jokokko

This comment has been minimized.

Copy link
Collaborator

jokokko commented Jan 23, 2018

Well, I hope to take a look at this in the near future. But just by gut feeling & past memory, I can see #834 relating. So addressing how LINQ expressions are evaluated, exposed and translated in the pipeline might provide better & more generalizable benefits overall, instead of attacking the problems case-by-case with a very spefic constructs built around the existing pipeline.

@jeremydmiller

This comment has been minimized.

Copy link
Contributor

jeremydmiller commented Jan 23, 2018

@jokokko Are you up for helping out on this if we really do take it on? Gonna put it off until I clear up a bit and get over the flu first though;-)

@jokokko

This comment has been minimized.

Copy link
Collaborator

jokokko commented Jan 25, 2018

@jeremydmiller Yeah I hope to help. Overall, I have to go through code to identify scenarios with dance around queries that the current LINQ provider cannot translate.

@jeremydmiller jeremydmiller added this to the 3.0 milestone Aug 31, 2018

@jeremydmiller jeremydmiller removed this from the 3.0 milestone Sep 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.