Jiry_XD
Jiry_XD
Explore posts from servers
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Gotcha thanks 😉
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Maybe one last thing I'd like to ask: If you look at OP's Question: https://stackoverflow.com/questions/78766403/net-ef-core-how-to-correctly-insert-and-update-a-model-in-a-many-to-many-rela You can see he holds both the junction and other entity Player:
public ICollection<Team> Teams { get; set; } = [];
public ICollection<TeamPlayer> TeamPlayers { get; set; } = [];
public ICollection<Team> Teams { get; set; } = [];
public ICollection<TeamPlayer> TeamPlayers { get; set; } = [];
Team:
public ICollection<Player> Players { get; set; } = [];
public ICollection<TeamPlayer> TeamPlayers { get; set; } = [];
public ICollection<Player> Players { get; set; } = [];
public ICollection<TeamPlayer> TeamPlayers { get; set; } = [];
In my case: I only want them with the price, is it okay to leave out List<Option> And just use the junction List<OptionMachine>? Or would that mean I have to use entityconfiguration?
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Thanks for the help 😉
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Doesn't matter haha it's right don't worry 😅
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
A machine can have many options an option can be linked to many machines
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
X => Machine Y => Option
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Its a many to many, X can have many Y and Y can have many X
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
I think the link will help me further
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
But thanks
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Thats why it is many to many afterall
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
You are right, I added this
builder.HasMany(x => x.Y)
.WithMany();
builder.HasMany(x => x.Y)
.WithMany();
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Thanks
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Cool, I'll check that out
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Actually, nevermind, Y is not supposed to have that list. EF Core knows X has a List of Y thus it is many to many by default
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Does that look right now?
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Sorry about that
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
My bad forgot to add it, let me edit it
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Because it is a many to many relationship
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Yes, it is, however I need an additional column in the junction table, as you can see I added Price. I don't know however if this is the right thing to do in EF Core
34 replies
CC#
Created by Jiry_XD on 11/20/2024 in #help
✅ EF Core Junction Tables with seperate columns
Pseudocode example: X Entity Class:
List<Y> YList;
// Other attributes
List<Y> YList;
// Other attributes
Y Entity Class:
//General attributes for Y.
//General attributes for Y.
XY Entity Class:
X X
Y Y
decimal Price
X X
Y Y
decimal Price
34 replies