Skip to content

DiscoverParentChildrenRelationships pulls all properties while DiscoverChildParentRelationships only pulls properties IsSimpleSqlType #209

Description

There appears to be an issue with how the DiscoverParentChildrenRelationships mapping is done.

DiscoverParentChildrenRelationships gets all properties, including properties where IsSimpleSqlType != true

however, when it tries to do the reverse, DiscoverChildParentRelationships, this only returns properties where IsSimpleSqlType == true.

In this example :
https://www.learndapper.com/relationships#dapper-one-to-many-relationships

public class Product
{
    public int ProductID { get; set; }
    public string ProductName { get; set; }
    ...
    public Category Category { get; set; }
}
public class Category
{
    public int CategoryID { get; set; }
    public string CategoryName { get; set; }
    ...
    public ICollection<Product> Products { get; set; }
}

This will fail because

DiscoverParentChildrenRelationships sees
public ICollection<Product> Products { get; set; }

but DiscoverChildParentRelationships DO NOT SEE
public Category Category { get; set; }

I have the fix ready, PR here :
#210

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions