V0FBU1VM
V0FBU1VM
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
I have always wanted to learn. I just forget the syntax for some reason. 🤣
68 replies
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
Thank you guys very much for the input. I learned some new stuffs.
68 replies
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
Oh I see.
68 replies
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
To be honest, I'm not very familiar with sql directly. I don't have a lot of knowledge in that field. That's why I'm using ef core.
68 replies
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
Not really no. 🤣
68 replies
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
It's a bit easier to read on the database side. Since I'm doing a lot of debuging at this stage.
68 replies
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
I see what you mean. Very good point.
68 replies
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
I do have a conversion though which might have led to the issue.
builder.Property(e => e.Role)
.HasConversion(
v => v.ToString(),
v => Enum.Parse<MemberRole>(v))
.IsRequired();
builder.Property(e => e.Role)
.HasConversion(
v => v.ToString(),
v => Enum.Parse<MemberRole>(v))
.IsRequired();
68 replies
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
I thought it would just compare the value assigned to the enum which is an int. So it sort of made sense. I guess om.Role != MemberRole.None makes more sense.
68 replies
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
I would still like to understand why though?
68 replies
CC#
Created by V0FBU1VM on 10/7/2024 in #help
✅ Ef Core unexpected query behaviour
After changing the comparison statement to om.Role != MemberRole.None all of a sudden it's working.
68 replies
CC#
Created by V0FBU1VM on 9/8/2024 in #help
✅ Navigation Property
Got it. Thanks guys. I really appreciate it.
20 replies
CC#
Created by V0FBU1VM on 9/8/2024 in #help
✅ Navigation Property
Thanks you guys very much.
20 replies
CC#
Created by V0FBU1VM on 9/8/2024 in #help
✅ Navigation Property
I get it.
20 replies
CC#
Created by V0FBU1VM on 9/8/2024 in #help
✅ Navigation Property
Oh I see, otherwise Shifts will have a department and the department will have shifts and so on and so forth.
20 replies
CC#
Created by V0FBU1VM on 9/8/2024 in #help
✅ Navigation Property
Yes.
20 replies
CC#
Created by V0FBU1VM on 9/8/2024 in #help
✅ Navigation Property
public ICollection<Shift> Shifts { get; set; } = new HashSet<Shift>();
public ICollection<Shift> Shifts { get; set; } = new HashSet<Shift>();
20 replies
CC#
Created by V0FBU1VM on 9/8/2024 in #help
✅ Navigation Property
I see, this is the proper way of doing it right? Or have i got it all wrong.
20 replies
CC#
Created by V0FBU1VM on 9/8/2024 in #help
✅ Navigation Property
It's appearing on top of Department. It's working fine. I'm just trying to understand the message properly.
20 replies
CC#
Created by V0FBU1VM on 9/8/2024 in #help
✅ Navigation Property
For instance here:
public class Shift
{
public int DepartmentId { get; init; }
public Department Department { get; init; }
}
public class Shift
{
public int DepartmentId { get; init; }
public Department Department { get; init; }
}
20 replies