Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1104
UltraGrid child band not showing columns when using EF classes generated by dotnet command
posted

Hi,

I am using EF class objects as grid datasources generated by command "dotnet ef dbcontext scaffold ...", which reside in another .Net Core project of the VS solution.

The parent class looks like:

namespace myDB.Models
{
    public partial class Parent
    {
        public Parent()
        {
            ParentChild = new HashSet<ParentChild>();
        }

        public int Id { get; set; }
        //some other properties...

        public virtual ICollection<ParentChild > ParentChild  { get; set; }
    }
}

This basically works fine when I only use a simple table with SingleBand.

Now I would like to also show the parent's children in the grid.

The child class:

namespace myDB.Models
{
    public partial class ParentChild
    {
        public int Id { get; set; }
        public int ParentId { get; set; }
        public string Name { get; set; }
        //some other properties...

        public virtual Parent Parent { get; set; }
    }
}

But in the grid it does not show me the children columns, instead I see 2 columns "IsReadOnly" and "Count". It seems like it has a problem with the HashSet or the ICollection property (which are generated by the .Net Core command by default).

Is there a way to solve this without having to edit the generated classes too much?

Thank you,

best regards

Parents Reply Children
No Data