I have an enum in an entity of the EF6 and it is stored as a byte in the database when saving the enum.
Now I want to mark a value of the Enum as Obsolete, but there will still be data using this value. It just is not used in the code.
Technically, I would like to delete this value in the code, but what would you do with the old data?
Migrate?
The good practice is to follow these steps:
If data migration can't be done because old value is still kept into the database, so I will follow these steps:
InvalidOperationException with a explicit message. <remark> that will help developers to know about what's going on.Notice I don't decorate the enum value with [Obsolete] attribute because this attribute means two things:
Those two things let developers that use version X to clean their actual code base (remove all use of the obsolete enum value) and get ready for version Y (no changes will be needed because all the job is done when using version X). You can't use [Obsolete] attribute because you said that old data will still exist into the database so you may need to display somewhere and you're not following the two things I said about [Obsolete] attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With