Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DataServiceConfiguration Class

Manages the configuration of WCF Data Services.

System.Object
  System.Data.Services.DataServiceConfiguration

Namespace:  System.Data.Services
Assembly:  System.Data.Services (in System.Data.Services.dll)
public sealed class DataServiceConfiguration : IDataServiceConfiguration

The DataServiceConfiguration type exposes the following members.

  NameDescription
Public propertyDataServiceBehaviorGets a DataServiceBehavior object that defines additional behaviors of the data service.
Public propertyEnableTypeConversionGets 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.
Public propertyMaxBatchCountGets or sets the maximum number of change sets and query operations that are allowed in a single batch.
Public propertyMaxChangesetCountGets or set the maximum number of changes that can be included in a single change set.
Public propertyMaxExpandCountGets or sets the maximum number of related entities that can be included in a single request by using the $expand operator.
Public propertyMaxExpandDepthGet or sets the maximum number of related entities that can be included in an $expand path in a single request.
Public propertyMaxObjectCountOnInsertGet or sets the maximum number of objects to insert that can be contained in a single POST request.
Public propertyMaxResultsPerCollectionGet or sets the maximum number of items in each returned collection.
Public propertyUseVerboseErrorsGets or sets whether verbose errors should be returned by the data service.
Top
  NameDescription
Public methodEnableTypeAccessRegisters a data type with the data service runtime so that it can be used by a custom data service provider.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRegisterKnownTypeAdds a type to the list of types that are recognized by the data service.
Public methodSetEntitySetAccessRuleSets the permissions for the specified entity set resource.
Public methodSetEntitySetPageSizeSets the maximum page size for an entity set resource.
Public methodSetServiceOperationAccessRuleSets the permissions for the specified service operation.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

This example shows the code-behind page for a Northwind-based data service, with access granted to selected entity sets.


using System.Data.Services;
using System.Linq;
using System.ServiceModel.Web;

namespace NorthwindService
{
    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);
        }
    }

}


.NET Framework

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.