DataServiceConfiguration Class
Manages the configuration of WCF Data Services.
Inheritance Hierarchy
System.Object
System.Data.Services.DataServiceConfiguration
Namespace: System.Data.Services
Assembly: Microsoft.Data.Services (in Microsoft.Data.Services.dll)
Syntax
'Declaration
Public NotInheritable Class DataServiceConfiguration _
Implements IDataServiceConfiguration
'Usage
Dim instance As DataServiceConfiguration
public sealed class DataServiceConfiguration : IDataServiceConfiguration
public ref class DataServiceConfiguration sealed : IDataServiceConfiguration
[<SealedAttribute>]
type DataServiceConfiguration =
class
interface IDataServiceConfiguration
end
public final class DataServiceConfiguration implements IDataServiceConfiguration
The DataServiceConfiguration type exposes the following members.
Properties
Name | Description | |
---|---|---|
AnnotationsBuilder | Builds the annotation models to be applied to the data model of the provider. | |
DataServiceBehavior | Gets a DataServiceBehavior object that defines the additional behaviors of the data service. | |
DisableValidationOnMetadataWrite | Gets or sets whether the data model is validated before it is written as a response to a request to the $metadata endpoint. | |
EnableTypeConversion | Gets or sets whether the data service runtime should convert the type that is contained in the payload to the actual property type that is specified in the request. | |
MaxBatchCount | Gets or sets the maximum number of change sets and query operations that are allowed in a single batch. | |
MaxChangesetCount | Gets or set the maximum number of changes that can be included in a single change set. | |
MaxExpandCount | Gets or sets the maximum number of related entities that can be included in a single request by using the $expand operator. | |
MaxExpandDepth | Get or sets the maximum number of related entities that can be included in an $expand path in a single request. | |
MaxObjectCountOnInsert | Get or sets the maximum number of objects to insert that can be contained in a single POST request. | |
MaxResultsPerCollection | Get or sets the maximum number of items in each returned collection. | |
UseVerboseErrors | Gets or sets whether the verbose errors should be returned by the data service. |
Top
Methods
Name | Description | |
---|---|---|
EnableTypeAccess | Registers a data type with the data service runtime so that it can be used by a custom data service provider. | |
Equals | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
RegisterKnownType | Adds a type to the list of types that are recognized by the data service. | |
SetEntitySetAccessRule | Sets the permissions for the specified entity set resource. | |
SetEntitySetPageSize | Sets the maximum page size for an entity set resource. | |
SetServiceActionAccessRule | Sets the permissions for the specified service action. | |
SetServiceOperationAccessRule | Sets the permissions for the specified service operation. | |
ToString | (Inherited from Object.) |
Top
Examples
This example shows the code-behind page for a Northwind-based data service, with access granted to selected entity sets.
Imports System.Data.Services
Imports System.Linq
Imports System.ServiceModel.Web
Public Class Northwind
Inherits DataService(Of NorthwindEntities)
' This method is called only once to initialize service-wide policies.
Public Shared Sub InitializeService(ByVal config As DataServiceConfiguration)
' Grant only the rights needed to support the client application.
config.SetEntitySetAccessRule("Orders", EntitySetRights.AllRead _
Or EntitySetRights.WriteMerge _
Or EntitySetRights.WriteReplace)
config.SetEntitySetAccessRule("Order_Details", EntitySetRights.AllRead _
Or EntitySetRights.AllWrite)
config.SetEntitySetAccessRule("Customers", EntitySetRights.AllRead)
End Sub
End Class
using System.Data.Services;
using System.Linq;
using System.ServiceModel.Web;
namespace NorthwindService
{
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class Northwind : DataService<NorthwindEntities>
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
// Grant only the rights needed to support the client application.
config.SetEntitySetAccessRule("Orders", EntitySetRights.AllRead
| EntitySetRights.WriteMerge
| EntitySetRights.WriteReplace);
config.SetEntitySetAccessRule("Order_Details", EntitySetRights.AllRead
| EntitySetRights.AllWrite);
config.SetEntitySetAccessRule("Customers", EntitySetRights.AllRead);
config.DataServiceBehavior.MaxProtocolVersion =
System.Data.Services.Common.DataServiceProtocolVersion.V3;
}
}
}
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
System.Data.Services Namespace