FastCrud icon indicating copy to clipboard operation
FastCrud copied to clipboard

DiscoverParentChildrenRelationships pulls all properties while DiscoverChildParentRelationships only pulls properties IsSimpleSqlType

Open ghost opened this issue 5 months ago • 0 comments

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 : https://github.com/MoonStorm/FastCrud/pull/210

ghost avatar Jul 03 '25 06:07 ghost