We discussed a number of extensible storage schema topics in the past.
Discussing that also provides an opportunity to summarise the other results we already have:
Deleting an Extensible Storage Schema
Question: I am unable to delete my extensible storage schema if the RVT project contains a linked project with the same schema.
First I thought I was doing something wrong, but the ExtensibleStorageUtility SDK sample project DeleteStorage command has the same problem.
Answer: Please be aware that all extensible storage schemata are held in memory and shared between all open projects in the current Revit session.
Therefore, if any of the currently open projects is making use of a specific schema, that will prevent it from being deleted.
I hope this is clear and explains the behaviour you are observing.
Updating an Extensible Storage Schema
Question: I need to add some additional fields to an existing extensible storage schema. How can I achieve this?
Right now, I am deleting the schema and creating a new one with all the required fields.
My current workaround to delete successfully is to unload the Revit links before deleting the schema.
Another solution I have been considering is to just leave the existing schema and create a new one. That seems a bit messy, though, so I have avoided that so far.
What is the best practice if you have an existing extensible storage scheme and you want to add more fields to it? A far as I can see, it is impossible to change existing schema fields.
Answer: Yes, indeed, schema fields cannot be modified, nor can new fields be added.
Once you publish a schema it is there, immutable, for the rest of the life of the universe.
If you wish to add new fields or modify existing ones, you have to create a new schema.
The old one remains untouched.
You can easily implement an update handler in your add-in that automatically updates all instances of the old schema that it encounters to the new one.
The full handouts and sample material are also available directly from The Building Coder.
Some additional topics that we covered since then include:
- Project wide data storage
- The DataStorage element
- Extensible storage extension
- Custom tagging and extensible storage
Response: I might change my mind on my current solution unloading and loading Revit links to be able to delete the schema, because it might still not solve problem in all cases. For instance, if users have two Revit projects open and both use the schema, I guess it will not work. All projects have the schema, because I add it on project open.
Answer: Yes, I think you can and certainly sooner or later will run into problems modifying an existing schema.
Creating a new one is the only safe way to go.