You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[severity:It bothers me. A fix would be nice]
Hello and thank you for reading... I think I found a bug and I would really appreciate any help if I'm missing something, it would be nice if you point out what the problem is.
I do have a class called FACT_Entry, which has a property List<FactComment> comments, each of these comments has a User (AppIdentityUser : IdentityUser), and they are linked through a key of type string. to simplify my classes are something like this: (reduced for simplicity)
public class FACT_Entry
{
public Guid tool_guid { get; set; }
public virtual List comments { get; set; } = new();
public string tool_name { get; set; }
}
public class FactComment
{
public Guid comment_guid { get; set; }
public Guid tool_guid { get; set; }
public string Comment { get; set; }
public string? created_by { get; set; }
public virtual AppIdentityUser User { get; set; }
}
public class AppIdentityUser : IdentityUser
{
public virtual List FactComments { get; set; }
}
In other words... each FACT tool has a list of comments, and each comment has the ID of the Identity user that created it, represented by AppIdentityUser class that inherits IdentityUser. I'm trying to load a single tool, with its comments and the user who created it, so I created something like this:
using TSMC_ODS_DbContext db = await odsContextFactory.CreateDbContextAsync(); //create my db context from factory
Editable_FACT = await db.FACT
.Include(FACT => FACT.comments)
.ThenInclude(comment => comment.User)
.FirstOrDefaultAsync(f => f.tool_name == "KEMGH5"); //KEMGH5 just a random name
THE PROBLEM is that I get the list of comments, but nothing from the ThenInclude, (no User, is null...) I did check if the SQL generated from EF and it returned the list as follows:
I did check my relationships and all are fine, indeed if not, EF could not find the info I want but it does, as we saw on the image.
I tried to use explicit loading but the result is the same, is this a bug? am I missing something? any help on this will be appreciated, I spent hours already not sure what to do here...
As usual, I cannot send you my whole project and database, as this belongs to my boss, but I can offer you remote access if you want to come and play by to find what's going on... thank you.
Original Comments
Feedback Bot on 5/22/2023, 04:31 AM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered:
This issue has been moved from a ticket on Developer Community.
[severity:It bothers me. A fix would be nice]
Hello and thank you for reading... I think I found a bug and I would really appreciate any help if I'm missing something, it would be nice if you point out what the problem is.
I do have a class called FACT_Entry, which has a property List<FactComment> comments, each of these comments has a User (AppIdentityUser : IdentityUser), and they are linked through a key of type string. to simplify my classes are something like this: (reduced for simplicity)
public class FACT_Entry
{
public Guid tool_guid { get; set; }
public virtual List comments { get; set; } = new();
public string tool_name { get; set; }
}
public class FactComment
{
public Guid comment_guid { get; set; }
public Guid tool_guid { get; set; }
public string Comment { get; set; }
public string? created_by { get; set; }
public virtual AppIdentityUser User { get; set; }
}
public class AppIdentityUser : IdentityUser
{
public virtual List FactComments { get; set; }
}
In other words... each FACT tool has a list of comments, and each comment has the ID of the Identity user that created it, represented by AppIdentityUser class that inherits IdentityUser. I'm trying to load a single tool, with its comments and the user who created it, so I created something like this:
THE PROBLEM is that I get the list of comments, but nothing from the ThenInclude, (no User, is null...) I did check if the SQL generated from EF and it returned the list as follows:
I did check my relationships and all are fine, indeed if not, EF could not find the info I want but it does, as we saw on the image.
I tried to use explicit loading but the result is the same, is this a bug? am I missing something? any help on this will be appreciated, I spent hours already not sure what to do here...
As usual, I cannot send you my whole project and database, as this belongs to my boss, but I can offer you remote access if you want to come and play by to find what's going on... thank you.
Original Comments
Feedback Bot on 5/22/2023, 04:31 AM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: