A property should be just that: a property. I.e. you get or set it and nothing else, no side effects. I know that even some .Net classes that violate this rule, but still it is a very healthy principle. Another principle is that it should not matter in which order properties of an object are being set. That is because setting any individual property should leave an object in a valid state.
So consider your Class
object, the way EF materializes it, to be valid. Then you can start modifying it. If you want to modify an object in a way that multiple properties are changed simultaneously, you should do this by calling a method with a descriptive name, not by setting one property and silently changing others.
If you want a list that presents a different content based on PropertList
, make a read-only (unmapped) property or a GetXyz()
method in which the changed content is generated (without modifying PropertList
!) and returned.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…