I'm fairly new to oop and programming in general, but one thing that i don't understand if when working with relational databases like in EF core you should have immutable objects or not.
If i set properties with private setters, so that i can only assign values when creating these objects, how can I change their state?
Do i create a new empty objects and then copy every single properties that needs to stay the same and update only some of them with myObject.property = updatedValue?
Do i use a factory to instanciate that object with the correct values?
Isn't this violating oop principles by having public setters?
I have encounter this problem for example when having a server and a client that exchange data and the client do somework on this data. When the data returns, with a dto class, i still need to update the related data that is saved in the database.