C# Class DataServiceProvider.DSPMetadata

Metadata definition for the DSP. This also implements the IDataServiceMetadataProvider.
Inheritance: IDataServiceMetadataProvider, ICloneable
Show file Open project: object/MongOData Class Usage Examples

Public Methods

Method Description
AddCollectionProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, System.Data.Services.Providers.ResourceType itemType ) : void

Adds a collection of complex or primitive items property.

AddCollectionProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, Type itemType ) : void

Adds a collection of primitive items property.

AddComplexProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, System.Data.Services.Providers.ResourceType complexType ) : void

Adds a complex property to the specified resourceType.

AddComplexType ( string name ) : System.Data.Services.Providers.ResourceType

Adds a new complex type (without any properties).

AddEntityType ( string name ) : System.Data.Services.Providers.ResourceType

Adds a new entity type (without any properties).

AddKeyProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, Type propertyType ) : void

Adds a key property to the specified resourceType.

AddPrimitiveProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, Type propertyType ) : void

Adds a primitive property to the specified resourceType.

AddResourceReferenceProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, System.Data.Services.Providers.ResourceSet targetResourceSet ) : void

Adds a resource reference property to the specified resourceType.

This creates a property pointing to a single resource in the target resource set.

AddResourceSet ( string name, System.Data.Services.Providers.ResourceType entityType ) : System.Data.Services.Providers.ResourceSet

Adds a resource set to the metadata definition.

AddResourceSetReferenceProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, System.Data.Services.Providers.ResourceSet targetResourceSet ) : void

Adds a resource set reference property to the specified resourceType.

This creates a property pointing to multiple resources in the target resource set.

Clone ( ) : object
DSPMetadata ( string containerName, string namespaceName ) : System

Creates new empty metadata definition.

GetDerivedTypes ( System.Data.Services.Providers.ResourceType resourceType ) : System.Collections.Generic.IEnumerable

Returns list of all types derived (directly or indirectly) from the specified resourceType.

Note that this method will get called even if the HasDerivedTypes returns false. The implementation should be reasonably fast as it can be called to process a query request. (Aside from being called for the $metadata processing).

GetResourceAssociationSet ( System.Data.Services.Providers.ResourceSet resourceSet, System.Data.Services.Providers.ResourceType resourceType, System.Data.Services.Providers.ResourceProperty resourceProperty ) : System.Data.Services.Providers.ResourceAssociationSet

Gets the ResourceAssociationSet instance when given the source association end.

This method returns a ResourceAssociationSet representing a reference which is specified by the resourceProperty on the resourceType for instances in the resourceSet.

HasDerivedTypes ( System.Data.Services.Providers.ResourceType resourceType ) : bool

Returns true if the specified type has some derived types.

The implementation should be fast as it will get called during normal request processing.

TryResolveResourceSet ( string name, System.Data.Services.Providers.ResourceSet &resourceSet ) : bool

Returnes a resource set specified by its name.

The implementation of this method should be very fast as it will get called for almost every request. It should also be fast for non-existing resource sets to avoid possible DoS attacks on the service.

TryResolveResourceType ( string name, System.Data.Services.Providers.ResourceType &resourceType ) : bool

Returnes a resource type specified by its name.

The implementation of this method should be very fast as it will get called for many requests. It should also be fast for non-existing resource types to avoid possible DoS attacks on the service.

TryResolveServiceOperation ( string name, System.Data.Services.Providers.ServiceOperation &serviceOperation ) : bool

Returns a service operation specified by its name.

The implementation of this method should be very fast as it will get called for many requests. It should also be fast for non-existing service operations to avoid possible DoS attacks on the service.

Private Methods

Method Description
AddPrimitiveProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, Type propertyType, bool isKey ) : void

Adds a key property to the specified resourceType.

AddReferenceProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, System.Data.Services.Providers.ResourceSet targetResourceSet, bool resourceSetReference ) : void

Helper method to add a reference property.

SetReadOnly ( ) : void

Marks the metadata as read-only.

Method Details

AddCollectionProperty() public method

Adds a collection of complex or primitive items property.
public AddCollectionProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, System.Data.Services.Providers.ResourceType itemType ) : void
resourceType System.Data.Services.Providers.ResourceType The resource type to add the property to.
name string The name of the property to add.
itemType System.Data.Services.Providers.ResourceType The resource type of the item in the collection.
return void

AddCollectionProperty() public method

Adds a collection of primitive items property.
public AddCollectionProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, Type itemType ) : void
resourceType System.Data.Services.Providers.ResourceType The resource type to add the property to.
name string The name of the property to add.
itemType System.Type The primitive CLR type of the item in the collection.
return void

AddComplexProperty() public method

Adds a complex property to the specified resourceType.
public AddComplexProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, System.Data.Services.Providers.ResourceType complexType ) : void
resourceType System.Data.Services.Providers.ResourceType The resource type to add the property to.
name string The name of the property to add.
complexType System.Data.Services.Providers.ResourceType Complex type to use for the property.
return void

AddComplexType() public method

Adds a new complex type (without any properties).
public AddComplexType ( string name ) : System.Data.Services.Providers.ResourceType
name string The name of the type.
return System.Data.Services.Providers.ResourceType

AddEntityType() public method

Adds a new entity type (without any properties).
public AddEntityType ( string name ) : System.Data.Services.Providers.ResourceType
name string The name of the type.
return System.Data.Services.Providers.ResourceType

AddKeyProperty() public method

Adds a key property to the specified resourceType.
public AddKeyProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, Type propertyType ) : void
resourceType System.Data.Services.Providers.ResourceType The resource type to add the property to.
name string The name of the property to add.
propertyType System.Type The CLR type of the property to add. This can be only a primitive type.
return void

AddPrimitiveProperty() public method

Adds a primitive property to the specified resourceType.
public AddPrimitiveProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, Type propertyType ) : void
resourceType System.Data.Services.Providers.ResourceType The resource type to add the property to.
name string The name of the property to add.
propertyType System.Type The CLR type of the property to add. This can be only a primitive type.
return void

AddResourceReferenceProperty() public method

Adds a resource reference property to the specified resourceType.
This creates a property pointing to a single resource in the target resource set.
public AddResourceReferenceProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, System.Data.Services.Providers.ResourceSet targetResourceSet ) : void
resourceType System.Data.Services.Providers.ResourceType The resource type to add the property to.
name string The name of the property to add.
targetResourceSet System.Data.Services.Providers.ResourceSet The resource set the resource reference property points to.
return void

AddResourceSet() public method

Adds a resource set to the metadata definition.
public AddResourceSet ( string name, System.Data.Services.Providers.ResourceType entityType ) : System.Data.Services.Providers.ResourceSet
name string The name of the resource set to add.
entityType System.Data.Services.Providers.ResourceType The type of entities in the resource set.
return System.Data.Services.Providers.ResourceSet

AddResourceSetReferenceProperty() public method

Adds a resource set reference property to the specified resourceType.
This creates a property pointing to multiple resources in the target resource set.
public AddResourceSetReferenceProperty ( System.Data.Services.Providers.ResourceType resourceType, string name, System.Data.Services.Providers.ResourceSet targetResourceSet ) : void
resourceType System.Data.Services.Providers.ResourceType The resource type to add the property to.
name string The name of the property to add.
targetResourceSet System.Data.Services.Providers.ResourceSet The resource set the resource reference property points to.
return void

Clone() public method

public Clone ( ) : object
return object

DSPMetadata() public method

Creates new empty metadata definition.
public DSPMetadata ( string containerName, string namespaceName ) : System
containerName string Name of the container to report.
namespaceName string Namespace name.
return System

GetDerivedTypes() public method

Returns list of all types derived (directly or indirectly) from the specified resourceType.
Note that this method will get called even if the HasDerivedTypes returns false. The implementation should be reasonably fast as it can be called to process a query request. (Aside from being called for the $metadata processing).
public GetDerivedTypes ( System.Data.Services.Providers.ResourceType resourceType ) : System.Collections.Generic.IEnumerable
resourceType System.Data.Services.Providers.ResourceType The resource type to determine derived types for.
return System.Collections.Generic.IEnumerable

GetResourceAssociationSet() public method

Gets the ResourceAssociationSet instance when given the source association end.
This method returns a ResourceAssociationSet representing a reference which is specified by the resourceProperty on the resourceType for instances in the resourceSet.
public GetResourceAssociationSet ( System.Data.Services.Providers.ResourceSet resourceSet, System.Data.Services.Providers.ResourceType resourceType, System.Data.Services.Providers.ResourceProperty resourceProperty ) : System.Data.Services.Providers.ResourceAssociationSet
resourceSet System.Data.Services.Providers.ResourceSet Resource set of the source association end.
resourceType System.Data.Services.Providers.ResourceType Resource type of the source association end.
resourceProperty System.Data.Services.Providers.ResourceProperty Resource property of the source association end.
return System.Data.Services.Providers.ResourceAssociationSet

HasDerivedTypes() public method

Returns true if the specified type has some derived types.
The implementation should be fast as it will get called during normal request processing.
public HasDerivedTypes ( System.Data.Services.Providers.ResourceType resourceType ) : bool
resourceType System.Data.Services.Providers.ResourceType The resource type to inspect.
return bool

TryResolveResourceSet() public method

Returnes a resource set specified by its name.
The implementation of this method should be very fast as it will get called for almost every request. It should also be fast for non-existing resource sets to avoid possible DoS attacks on the service.
public TryResolveResourceSet ( string name, System.Data.Services.Providers.ResourceSet &resourceSet ) : bool
name string The name of the resource set find.
resourceSet System.Data.Services.Providers.ResourceSet The resource set instance found.
return bool

TryResolveResourceType() public method

Returnes a resource type specified by its name.
The implementation of this method should be very fast as it will get called for many requests. It should also be fast for non-existing resource types to avoid possible DoS attacks on the service.
public TryResolveResourceType ( string name, System.Data.Services.Providers.ResourceType &resourceType ) : bool
name string The full name of the resource type (including its namespace).
resourceType System.Data.Services.Providers.ResourceType The resource type instance found.
return bool

TryResolveServiceOperation() public method

Returns a service operation specified by its name.
The implementation of this method should be very fast as it will get called for many requests. It should also be fast for non-existing service operations to avoid possible DoS attacks on the service.
public TryResolveServiceOperation ( string name, System.Data.Services.Providers.ServiceOperation &serviceOperation ) : bool
name string The name of the service operation to find.
serviceOperation System.Data.Services.Providers.ServiceOperation The service operation instance found.
return bool