DataServiceConfiguration クラス

WCF Data Services の構成を管理します。

継承階層

System.Object
  System.Data.Services.DataServiceConfiguration

名前空間:  System.Data.Services
アセンブリ:  Microsoft.Data.Services (Microsoft.Data.Services.dll)

構文

'宣言
Public NotInheritable Class DataServiceConfiguration _
    Implements IDataServiceConfiguration
'使用
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

DataServiceConfiguration 型は、以下のメンバーを公開しています。

プロパティ

  名前 説明
パブリック プロパティ AnnotationsBuilder プロバイダーのデータ モデルに適用する注釈モデルを構築します。
パブリック プロパティ DataServiceBehavior データ サービスの追加の動作を定義する DataServiceBehavior オブジェクトを取得します。
パブリック プロパティ DisableValidationOnMetadataWrite データ モデルが $metadata エンドポイントに対する要求への応答として記述される前に、そのデータ モデルを検証するかどうかを取得または設定します。
パブリック プロパティ EnableTypeConversion ペイロードに含まれている型を、要求で指定された実際のプロパティ型にデータ サービス ランタイムで変換するかどうかを取得または設定します。
パブリック プロパティ MaxBatchCount 単一のバッチで許可される変更セットおよびクエリ操作の最大数を取得または設定します。
パブリック プロパティ MaxChangesetCount 単一の変更セットに含めることのできる変更の最大数を取得または設定します。
パブリック プロパティ MaxExpandCount $expand 演算子を使って単一の要求に含めることのできる関連エンティティの最大数を取得または設定します。
パブリック プロパティ MaxExpandDepth 単一の要求の $expand パスに含めることのできる関連エンティティの最大数を取得または設定します。
パブリック プロパティ MaxObjectCountOnInsert 単一の POST 要求に含めることのできる挿入対象オブジェクトの最大数を取得または設定します。
パブリック プロパティ MaxResultsPerCollection 返される各コレクションに含まれる項目の最大数を取得または設定します。
パブリック プロパティ UseVerboseErrors データ サービスから詳細なエラーが返されるかどうかを取得または設定します。

先頭に戻る

メソッド

  名前 説明
パブリック メソッド EnableTypeAccess データ サービス ランタイムにデータ型を登録し、カスタム データ サービス プロバイダーがその型を使用できるようにします。
パブリック メソッド Equals (Object から継承されています。)
プロテクト メソッド Finalize (Object から継承されています。)
パブリック メソッド GetHashCode (Object から継承されています。)
パブリック メソッド GetType (Object から継承されています。)
プロテクト メソッド MemberwiseClone (Object から継承されています。)
パブリック メソッド RegisterKnownType データ サービスで認識される型のリストに型を追加します。
パブリック メソッド SetEntitySetAccessRule 指定されたエンティティ セット リソースのアクセス許可を設定します。
パブリック メソッド SetEntitySetPageSize エンティティ セット リソースの最大ページ サイズを設定します。
パブリック メソッド SetServiceActionAccessRule 指定されたサービス アクションのアクセス許可を設定します。
パブリック メソッド SetServiceOperationAccessRule 指定されたサービス操作のアクセス許可を設定します。
パブリック メソッド ToString (Object から継承されています。)

先頭に戻る

使用例

この例では、Northwind ベースのデータ サービスの分離コード ページで、選択したエンティティ セットにアクセス権を設定します。

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;
        }
    }
}

スレッド セーフ

この型の public static (Visual Basic では Shared) のメンバーはすべて、スレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。

関連項目

参照

System.Data.Services 名前空間

その他の技術情報

データ サービスの構成 (WCF Data Services)