I have a situation where I have a block that should only appear in a few specific content areas. Meaning I want to prevent it from being used anywhere else. I know you can use the [AllowedTypes(...)] attribute on specific ContentArea properties to allow or restrict types, but short of setting [AllowedTypes(...)] with my particular block type as restricted on every single ContentArea in the entire solution, is there some way for me to indicate that the default behavior for this block is for it to be restricted?
Use allowed types with an interface so you only need to decorate where you want the block to be used: https://world.episerver.com/blogs/Ben-McKernan/Dates/2015/2/the-new-and-improved-allowed-types/
Implement an IValidator interface that checks the content areas on a page and looks for your block type and warn users appropriately: https://www.david-tec.com/2012/06/EPiServer-7-Preview---IValidator-interface/
I may be a little late to this game, but I use eGandalf's plugin for doing this. https://github.com/egandalf/eGandalf.Epi.Validation
You can grab it from the Epi nuget package manager.