Skip to content

Filtering on bi-directional 1:0-1 relationships #121

@rhyskoedijk

Description

@rhyskoedijk

I've just checked out the source code and I can see there is a known issue (and unit test) for supporting relationships without having the foreign key specified on the model.

I am wondering if this the same reason why bi-directional 1:0-1 relationships don't work, or if this is due to another issue? Here is an example of a broken model based off the existing unit tests:

    public class EntityE : EntityBase
    {
        public int ChildID { get; set; }
        public EntityEChild Child { get; set; }
    }

    public class EntityEChild : EntityBase
    {
        public EntityE Parent { get; set; } // Link-back to my parent
        public int ChildValue { get; set; }
    }

modelBuilder.Entity<EntityE>().HasOptional(x => x.Child).WithOptionalPrincipal(x => x.Parent);

Could I modify DynamicFilterQueryVisitorCSpace to skip over the dependent side of the navigation property? There would be no need to follow Parent backwards as filtering should have already been applied prior to reaching EntityEChild in this instance right?

Any guidance/ideas on how I can (temporarily) resolve this issue would be grateful.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions