存储配置和/或用户首选项类型信息的一种方便方法是使用 XML 。许多 DBMS 支持 XML 数据类型。XML 语法允许您随着配置的发展扩展描述配置的“语言”和结构。XML 的一个优点是它对层次结构的隐式支持,例如允许存储小的配置参数列表,而不必使用编号后缀来命名这些参数。XML 格式的一个可能的缺点是,搜索和通常修改这些数据并不像其他方法那样直接(没有什么复杂的,但不是那么简单/自然)
EntityId (foreign key to the "owner" of this attribute)
AttributeId (foreign key to the "metadata" table where the attribute is defined)
StringValue (it is often convenient to have different columns of different types
IntValue allowing to store the various attributes in a format that befits
them)
AttributeId (Primary Key)
Name
AttributeType (some code S = string, I = Int etc.)
Required (some boolean indicating that this is required)
Some_other_fields (for example to define in which order these attributes get displayed etc...)