Cpt. Reis
Proper usage of EF Core in teams?
hi all!
i dipped my toes into the world of .NET half a year ago (coming from the Java ecosystem). and so far, i like it quite much.
but one thing that keeps me struggling - EF Core. while i understand its power and benefits, it seems to be hard to use it in teams, especially when teams get larger and DB-involving features are implemented concurrently.
- the context model snapshot is something that always brings merge conflicts, and a little mistake when resolving them may cause a dangerous inconsistency
- the timestamps of the migrations can be a problem, especially if a "newer" feature is merged before an older one, and the timestamps are in wrong order then
- if you deploy stuff including DB changes to testing environments, e.g. new columns remain there, even if a different branch without those changes is deployed at a later point. that would require more maintenance because you'd have to configure CICD to do a rollback or something... you could also drop the db and recreate, but if you have environments that have some complex test data present, you would probably want to avoid such a nuke
maybe i'm just missing out something and it feels harder to me than it actually is.
but how is EF Core supposed to be productively used within teams, while avoid a lot of additional work?
8 replies
Unit/Integration testing - what are good approaches?
hey! i'm working in my first C# / .NET project and i'm excited to learn new stuff (having Java/Spring background), as .NET is a whole new experience for me.
in the former project, we had really good test setup - a ton of integration tests covering everything, working with test containers to build a database instance for the tests. tests were run on each PR via git actions, which guaranteed working tests on the main branches.
in my new project, we're in the "forming" phase, so it's not that consistent yet from a technical perspective. meaning, we're wrapping our heads around a solid setup.
and i wonder about a few points:
- would you prefer unit or integration tests, and why?
- how can the test setup be done effieciently in .NET - so that we spin up a database and run the migrations there for example, to rebuild the correct structure?
- do you have some general tips for testing in .NET for me?
thankful for your thoughts!
4 replies