I have a question about adding fields to an entity I've defined in a drupal 7 module upgrading from d6 which has 4 types. The modules get a list of fields from a 3rd party server and if the user enables them through the admin interface they are added to the node object as cck fields before the node gets saved. Can I add fields to a bundle in a similar fashion using field_create_instance? Is it okay if the same type entity has different fields in different cases, or does the field get added to every entity of that type once it's added?
There are different resources (think data coming from different servers with potentially different fields) each with the same 4 entity types, and different fields could be enabled for each resource. I'm considering adding the fields which are enabled to the entity before it is saved. Entity type 1 could have different fields selected for resource 1 and resource 2. This is the first time I have used d7 entities which is why I'm asking how they work.