I am trying to figure out if there is a difference between saving an instance of an entity and saving the definition of an entity.
My use case is this: I wrote a small module that defines an entity, which I then used in other code on my site. All of this worked just fine, and I thought that once I had created some instances of my entity, and that those instances were stored in my database, I could then disable the little module that defined my entity. I thought, in other words, that defining an entity would be like defining a Content Type, and that once you had done so the new entity, like a new Content Type, would "stick around".
That, however, is not how things work. If I disable the little module that defines the new entity, that entity disappears from my system, and the code that uses that entity fails. Re-enabling the little entity-defining module returns everything to normal and the site works again.
I think I may have missed a step here [entity_save?] but find nothing in the documentation that discusses saving the definition of a programatically defined entity.
Two more things. First, I have noticed that the "model" module, which provides a template for creating your own entities, exhibits the same behavior that my little module did: if I disable that module, the entities that I used it to define vanish from my system. I have also noticed that the Entity Construction Kit [ECK] creates, in addition to the base table, two additional tables, one of which, eck_bundles, looks like it has entity properties. I have not been willing to disable the ECK, though, because the documentation says that Drupal needs it.
Another way of posing my question would be this: "Do you have to keep the code that defines your entity in your system, or is there some way of storing the entity definition for subsequent use?"
I am running Drupal 7.39