mg
mg
CC#
Created by BondAddict on 12/26/2024 in #help
Does anyone have advice on dealing with Blazor not being reactive out of the box?
assuming you're referring to the UI not updating when the state changes, the issues i've had with that were mostly resolved by ensuring all my UI event handlers were EventCallbacks, which automatically re-render components after the callback finishes
4 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
what i didn't include (but probably should have, sorry) was the definition of AB
public class AB
{
public int AId { get; set; }
public int BId { get; set; }
public A? A { get; set; }
public B? B { get; set; }
}
public class AB
{
public int AId { get; set; }
public int BId { get; set; }
public A? A { get; set; }
public B? B { get; set; }
}
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
but i'll get back to you
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
not right now, advent of code day 17 is about to drop lol
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
what you posted is an example of an explicit join entity, yes
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
it's not going to be 100% analagous to your case because your case doesn't have two different entities being joined
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
i'm referring to what i described and posted pseudocode for
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
A and B are both User
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
not really, in your case A and B are just the same entity
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
this is the general form of what i do
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
looks like it could work. does it?
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
the difference is that if you explicitly create a type and DbSet for it then you can query the join table directly and also add more columns on to it if you need to
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
yes
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
yes
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
having a class AB to represent the join table between A and B
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
object is always nullable
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
not sure, i use explicit join types
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
required requires you to supply a value when initializing an instance of the class
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
EF doesn't care about required. If the property is a non-nullable guid, it'll be required in the database
48 replies
CC#
Created by surwren on 12/17/2024 in #help
Puzzled about Nullability in EFCore
I personally like to explicitly type my many to many relationships, so for me if A and B have a many-to-many relationship through the join table AB then I have
class A
{
public List<B> Bs { get; set; } = [];
}

class B
{
public List<A> As { get; set; } = [];
}
class A
{
public List<B> Bs { get; set; } = [];
}

class B
{
public List<A> As { get; set; } = [];
}
and then configure them with HasMany(a => a.Bs).WithMany(b => b.As).UsingEntity<AB>() using the fluent api
48 replies