Keswiik
Keswiik
CC#
Created by splorgamus on 11/23/2024 in #help
I need help implementing recursion in a general way
yup, sounds right to me
6 replies
CC#
Created by splorgamus on 11/23/2024 in #help
I need help implementing recursion in a general way
given that example, what do you think your base and recursive cases would be?
6 replies
CC#
Created by splorgamus on 11/23/2024 in #help
I need help implementing recursion in a general way
I feel like you're gonna have a hard time getting good responses with the way you've phrased this question. What exactly do you need help with? Got examples of something you're having a hard time translating into a recursive function?
6 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
:PepoSalute: gl
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
I've had times where the EF change tracker tried re-creating the entities specified if the nav property was set to something that already existed
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
var newMachine = new Machine {
// stuff here
Options = new() {
new() {
OptionId = someExistingOption.Id
}
}
};
var newMachine = new Machine {
// stuff here
Options = new() {
new() {
OptionId = someExistingOption.Id
}
}
};
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
i would probably do something like
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
say, for example, you are creating a new machine that references an existing option
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
one thing to note, though, if you are creating a new entity and it references other entities that already exist, you may only need to set the ID on your join entity
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
:PepoSalute:
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
Yup
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
There are probably cases where having access to the other nav collection would be useful, but I don't use it myself
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
No, I only use the explicit join table in my entities
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
Not sure, I always set my many-many relationships up to use an explicit join table
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
public class OptionMachine {
[ForeignKey("Machine")]
public int MachineId { get; set; } = default;
public Machine? Machine { get; set; } # nullable because you can load the junction entity without loading the nav props

[ForeignKey("Option")]
public int OptionId { get; set; } = default;
public Option? Option { get; set; }

[Required]
public decimal Price { get; set; } = default;
}
public class OptionMachine {
[ForeignKey("Machine")]
public int MachineId { get; set; } = default;
public Machine? Machine { get; set; } # nullable because you can load the junction entity without loading the nav props

[ForeignKey("Option")]
public int OptionId { get; set; } = default;
public Option? Option { get; set; }

[Required]
public decimal Price { get; set; } = default;
}
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
I also don't know why you're not using auto props here
26 replies
CC#
Created by Jiry_XD on 11/21/2024 in #help
✅ Seeding question
You do not have to set Machine in your OptionMachine entity for this to work. Assuming your relationships aren't messed up, EF should handle this for you. https://learn.microsoft.com/en-us/ef/core/saving/related-data#adding-a-graph-of-new-entities
26 replies
CC#
Created by 'brella boy on 11/19/2024 in #help
✅ i have 44 errors that I don't know how to fix
^ although i think i misread his class, thought he was trying to re-assign the declared x and y fields but i had to zoom in a bit lol
171 replies
CC#
Created by 'brella boy on 11/19/2024 in #help
✅ i have 44 errors that I don't know how to fix
you have statements outside of any method body actually those might be fine, misread
171 replies
CC#
Created by 'brella boy on 11/19/2024 in #help
✅ i have 44 errors that I don't know how to fix
look at lines 27 and 28 of your first image
171 replies