Home: FDO Developer's Guide
Modifying Models
Schema Management
Rollback Mechanism
Schema Element States
All elements within the model maintain
a state flag. This flag can be retrieved by calling FdoSchemaElement::GetElementState(),
but it cannot be directly set. Instead, its state changes in reaction
to the changes made to the model:
- Unchanged. When
a schema model is retrieved via FdoIDescribeSchema, all elements
are initially marked Unchanged.
- Detached. Removing
an element from an owning collection sets its state to Detached.
- Deleted. Calling
the Delete() method on an element sets its state to Deleted.
- Added. Placing
an element within a collection marks the element as Added.
- Modified. When
adding or removing a sub-element, such as a property element from
a class, the class element state will be changed to Modified.
Additionally, when an element that is contained
by another element is changed in any way, the containing element
is also marked as Modified. So, for example, if a new value is added
to the SchemaAttributeDictionary of the “Class3” element in our
model, both the “Class3” FdoClass object and the FdoFeatureSchema
object would be marked as Modified.
The state flags are maintained until the changes
are accepted, that is, when IApplySchema is executed. At that time,
all elements marked Deleted are released and all other elements
are set to Unchanged.
NoteWhen you remove an element
from an owning collection, its state is marked as Detached. All
collections currently in FDO are owning collections, except for
one, the collections FdoClassDefinition::GetIdentityProperties().