MSDN Library

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)

public void EnableTypeAccess(
	string typeName


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

This method is used to register a type with the Astoria runtime which may be returned in the “open properties” of an open type such that the type is visible in $metadata output and usable with CRUD operations. The typename parameter must be a namespace qualified type name (format: <namespace>.<typename>). The name provided must be as it would show up in a CSDL document (ie. model types, not CLR types) The types registered via calls to EnableAccess will be additive to those implicitly made accessible via DSC.SetEntitySetAccessRule(…) invocations • Note: The Astoria runtime layer won’t be able to determine if a typename specified maps to an Entity Type, Complex Type, etc until it actually obtains type info (entity types, complex types, etc) from the underlying provider • “*” can be used as the value of ‘typename’, which will be interpreted as matching all types When Astoria enumerates types or needs to obtain a type (Complex Types, Entity Types) from the underlying provider it will first determine if the type should be visible (show in $metadata and accessible via operations exposed by the service) as per the standard v1 checks (ie. driven by SetEntitySetAccessRule calls). If the type is not visible via V1 rules, then we consult the set of types registered via EnableAccess(<typename>) invocations. If the type was included in such a call then the type is visible via $metadata and can be accessed via CRUD ops, etc. If a type is not made visible via one of the mechanisms above, then: • That type must not be included a response to a $metadata request • Instances of the type must not be returned to the client as the response of a request to the data service. If such a type instance would be required the service MUST fail the request. Failure semantics are covered in the area of the specification which covers request/response semantics with respect to open types. Invoking this method multiple times with the same type name is allowed and considered a “NO OP”.

© 2015 Microsoft