다음을 통해 공유


Mapping Object Type Identifiers and Properties to Generic Types

The Visual Studio metadata engine recognizes generic objects like tables, views, and stored procedures, as well as generic properties on these objects. On the other hand, the object types described by data providers using XML will not natively describe the types in such a generic form.

Because of this, object types must contain information that maps the type, its identifier, and its properties to various generic concepts that are recognizable to the metadata engine. The metadata engine then applies this mapping. It is up to the object type to provide the information necessary to enable this mapping.

The Mapping Problem

Mapping from source-specific data to generic concepts can be somewhat arbitrary, so you cannot rely on simple 1:1 mappings.

Mapping back ends to generic concepts introduces complexities that we'll refer to as the b:g mapping problem.

To illustrate the problem, consider that a data source could define a type that maps to multiple generic concepts (1:g), or that a generic property could be split into multiple data-source-specific properties (b:1). (You can find a more developed discussion of the b:g mapping problem in Type Mapping.)

Furthermore, for identifier part and property mappings there is the additional matter of deciding how best to convert source-specific data into the format required by generic concepts. For example, a database could define a CreateDate property that returns a string, while the generic concept that maps to this property is an actual DateTime type. In this case, the data provider needs a way to format the string such that it can be converted into this DateTime type, and then to perform the conversion.

A complete solution to these mapping problems is difficult to achieve without using custom code, however, a certain amount of static information about mapping can solve many of the inherent difficulties. The following sections describe in more detail how the schema definition provides mapping information that helps solve these problems:

See Also

Concepts

Mapping Generic Restrictions to Datasource Requirements