Ef core help
Hi! Working on my first blazor project for work and habr a few questions if anyone has any help with any of them .
1. Using ef core 9 (prob) and I used ef core power tools to reverse engineer the db I have (I need a few tables for this project of the 100 or so the other projects use ). It generated the classes in the models folder but I need to add some helper functions. I kinda just added another folder and dropped a file for each and made the same partial class. What's the right way to do that ?
2. The model I'm doing in ef core 9 currently exists in ef6 (non core) and is used by many other projects . Would a good way to migrate be to use ef core 3 on this and kinda add this to the old stuff ? Or would migrating the ef6 to ef core 3 be better ? The old code is all .net is .netframework 4.7
14 Replies
1. What helper functions? Database entities should generally be "dumb" and only describe the data
Unknown User•7d ago
Message Not Public
Sign In & Join Server To View
The first one that I'm doing is overriding the equals and gethashcode. I guess that could be in a service instead ?
Issue is all of the original code which won't move for years is 4.7 which I didn't think can use core 9
I guess overrides are fine, though I'll admit I never had the need to compare database entities
Unknown User•7d ago
Message Not Public
Sign In & Join Server To View
Ya that's why I was thinning ef core 3
I wasn't sure if I should somehow wrap my new ef core 9 stuff and use it in the framework or do core 3 and migrate or just kinda have all this code in 2 places
Unknown User•7d ago
Message Not Public
Sign In & Join Server To View
In this case the rows are people + job title combos kinda . So 1 person could be there 3 times for 3 jobs. Yes I know it should just be 2 tables with a link probsbly but the people above me don't want that... No idea why
If I cna use core 3 in my new priject, I could use the same code in the old 0rijects for the models
Unknown User•7d ago
Message Not Public
Sign In & Join Server To View
Ya
Unknown User•7d ago
Message Not Public
Sign In & Join Server To View
Both I guess. I'm not quite sure the distinction tbh
Unknown User•7d ago
Message Not Public
Sign In & Join Server To View
I've never liked orms so I never went too deep in learning them which is biting me in the ass
We have a user model project right now that like 6 programs use that are all netfx . The user model project is ef6 with its edmx file and then a bunch of class files with all sorts of custom code . My new priject is rewriting basically an address book so I was using blazor cause I have no desire to write a netfx web forms app from scratch in 2025
I'm changing the data structure of the user model tables , so the edmx would need to be changed as well. That's where I was thinking I could update the ef6 to core3 and use it in both , or just kinda say fuck it, make the changes in both seapatetly and then in 10 years bring the old netfx stuff to core and use the new model priject