I'm working on my first EPI Server project and I have noticed that when I create a property on a 'Page Type' in C# Code, compile it, I can see the properties in Episerver.
However when I then delete that property in code the property still appears in the back office, and I have to manually delete it in the admin section.
Is there a setting in Epi server that will automatically delete properties from the EPI server database when they are removed from code? It seems very strange that you would have to delete the properties one by one every time you make a change to a Page Type.
Ultimately it's about data & data loss. Whenever you create a property in code, users/admins/other code can put data into that property which is stored in the database. However if you modify or remove a field, the data stored must be dealt with, to prevent data loss.
Imagine the scenario where you have a production site running for a year. A developer finds out that one of the properties have a typo in them and fixes that so it correctly spelled again and pushes this to production. If it would automatically remove the field, it would have to remove the data from the database as well and suddenly the "same" property have now lost all its data!
I don't know if there is any nice API doing that, haven't checked, but I'm sure there are threads about it! Or just look through the APIs to see if you can find that flag somewhere, where it's not defined in code! :)
Joel's answer is right. I just want to add more thing that if a property is deleted from code and the editor never put any data for this property then this property is still deleted automatically after deploying new code
The following plugin makes identifing and deleting missing properties much easier: https://world.episerver.com/blogs/Per-Nergard/Dates/2013/3/Plugin-for-deleting-missing-properties/
Haven't used it for a long time and it may require some tweaking to work with Episerver 11, but I remember the code is pretty straightforward.