Data
The role of metadata (metadata) in enterprise application development
Meta data (metadata) Introduction:
Metadata (metadata), which is the data about data, has been widely used in software design in recent years Metadata.
In programming, metadata is not an object to be processed, but rather changes the data of the program's running by changing some "values" of the metadata.
You can "interpret" the runtime of a program, and different metadata values allow the same program to have different running results.
Meta-data (metadata) applications:
In the previous work, often encountered such a problem,
}
This often happens during development and actual operation, and after a period of time the user's actual situation changes, you may want to add one or more fields to the table in the entity above and the database that corresponds to it. We can only modify this data entity, and after the code development is complete, making such modifications is cumbersome and potentially dangerous.
Imagine the current situation, for various reasons need to change the above data structure, we intend to add two fields "Price" "Createtime", there is any way to make the data entity easy to adapt to this change?
Two ways:
1 Add a description of the added field in table Dprofile the name of the metadata field is Fieldsmetainfo, and the data type can be defined as a text type or a binary type such as image. In this field, define an XML-formatted document description and store the newly added field.
This newly added field records other information such as data type information and data information that may be added to the field in the future.
2) Add two tables
Store newly added field information in a table
Table Profilefields
ID int
FieldName nvarchar (50)
FieldType nvarchar (50)
Table Profilefieldsvalue
ID int
profileID int
Profilevalue varchar (50)
Profilefields table stores additional field name types and other information
Table Profilefieldsvalue table stores values corresponding to filed
Adding a property of a custom type in the data entity class returns the data stored in the source data structure
Can be a Hashtable type, or it can be a custom other collection type
Private Hashtable metafieldslist;
Custom architecture for easy storage and updating
Meta-data (metadata) data storage structure:
Metadata has many storage formats, most of which are in XML format.
XML is best used for storing metadata, easy to use and parse.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.