Skip to content

Is there a way to join by IKey/IForeignKey? #14864

@OpenSpacesAndPlaces

Description

@OpenSpacesAndPlaces

I already can query like (which is fine for a single field FK):

var query = (from child in mcc.Set<KChild>()
				    join parent in mcc.Set<KParent>() on child.GetPropertyValue(sChildKeyName) equals parent.GetPropertyValue(sParentKeyName)
				    select child);

The problem I'm running into is that I want to be able to generically do a join that might contain an unknown composite key with names that might vary across tables.

I already have IKey and 'IForeignKey' pulled - Is there a way to-do a query like the pseudo? (in particular agnostic to name differences)

var query = (from child in mcc.Set<KChild>()
				    join parent in mcc.Set<KParent>() on IKey equals IForeignKey
				    select child);

I see the path forward if you can guarantee the names were the same, but if the key names were different across KChild and KParent, then that falls apart.


I'm hoping there is already something I'm missing that has a dictionary like Dictionary<IProperty,IProperty> where we are mapping IKey properties to the 'IForeignKey' properties (one to one vs. inferred from reflection/naming/default because of there being one).

Thanks in advance for the help!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions