Επεξεργασία

Κοινή χρήση μέσω


DataServiceConfiguration.EnableTypeAccess(String) Method

Definition

Registers a data type with the data service runtime so that it can be used by a custom data service provider.

public:
 void EnableTypeAccess(System::String ^ typeName);
public void EnableTypeAccess (string typeName);
member this.EnableTypeAccess : string -> unit
Public Sub EnableTypeAccess (typeName As String)

Parameters

typeName
String

The namespace-qualified name of the type that is enabled for use with the custom data service provider.

Remarks

The EnableTypeAccess method is used to register a type with the data service runtime. After registration, a type can be returned in the properties of an open type. This makes the type visible in $metadata output and usable by the data service.

The supplied typeName must be defined in the same format as a type in the data model and not as a CLR type. The registered types are added to those types already made available by calling the SetEntitySetAccessRule method.

The data service runtime cannot determine what kind of data type the typeName maps to until information about the type can be obtained from the underlying provider.

A value of '*' can be supplied for typeName, which matches all types.

When the data service runtime enumerates types or must obtain a type from the underlying data provider, it must first determine whether the type must be visible when the SetEntitySetAccessRule method is called. When the type is not available in this manner, then types registered by using the EnableTypeAccess method are checked. When a type is not made visible by using either of these mechanisms, that type is not included in the response to a $metadata request, and instances of that type are not returned to the client as the response of a request to the data service.

The EnableTypeAccess method can be called many times with the same type name.

Applies to

See also