DataServiceConfiguration.EnableTypeAccess Method

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

Namespace:  System.Data.Services
Assembly:  Microsoft.Data.Services (in Microsoft.Data.Services.dll)

Syntax

'Declaration
Public Sub EnableTypeAccess ( _
    typeName As String _
)
'Usage
Dim instance As DataServiceConfiguration 
Dim typeName As String

instance.EnableTypeAccess(typeName)
public void EnableTypeAccess(
    string typeName
)
public:
void EnableTypeAccess(
    String^ typeName
)
member EnableTypeAccess : 
        typeName:string -> unit
public function EnableTypeAccess(
    typeName : String
)

Parameters

  • typeName
    Type: System.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.

See Also

Reference

DataServiceConfiguration Class

System.Data.Services Namespace

Other Resources

Configuring the Data Service (WCF Data Services)