다음을 통해 공유


DataServiceConfiguration.SetEntitySetAccessRule 메서드

지정된 엔터티 집합 리소스에 대한 사용 권한을 설정합니다.

네임스페이스:  System.Data.Services
어셈블리:  Microsoft.Data.Services(Microsoft.Data.Services.dll)

구문

‘선언
Public Sub SetEntitySetAccessRule ( _
    name As String, _
    rights As EntitySetRights _
)
‘사용 방법
Dim instance As DataServiceConfiguration
Dim name As String
Dim rights As EntitySetRights

instance.SetEntitySetAccessRule(name, _
    rights)
public void SetEntitySetAccessRule(
    string name,
    EntitySetRights rights
)
public:
virtual void SetEntitySetAccessRule(
    String^ name, 
    EntitySetRights rights
) sealed
abstract SetEntitySetAccessRule : 
        name:string * 
        rights:EntitySetRights -> unit 
override SetEntitySetAccessRule : 
        name:string * 
        rights:EntitySetRights -> unit 
public final function SetEntitySetAccessRule(
    name : String, 
    rights : EntitySetRights
)

매개 변수

  • name
    유형: System.String
    사용 권한을 설정할 엔터티 집합의 이름입니다.

구현

IDataServiceConfiguration.SetEntitySetAccessRule(String, EntitySetRights)

주의

name 매개 변수에 대해 별표 값(*)을 지정하면 사용 권한이 명시적으로 설정되지 않은 모든 엔터티 집합에 대해 사용 권한이 설정됩니다.

이 예제에서는 선택한 엔터티 집합에 부여된 액세스를 사용하여 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;
        }
    }
}

참고 항목

참조

DataServiceConfiguration 클래스

System.Data.Services 네임스페이스

관련 자료

데이터 서비스 구성(WCF Data Services)