ServiceOperationRights 枚举


一个枚举,用于定义对 WCF Data Services 所部署服务操作的访问权限。An enumeration used to define access rights to service operations deployed by WCF Data Services.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

public enum class ServiceOperationRights
public enum ServiceOperationRights
type ServiceOperationRights = 
Public Enum ServiceOperationRights


All 3

分配给服务操作的所有权限。All rights assigned to the service operation.

AllRead 3

授权读取服务操作所部署的一个或多个数据项。Authorization to read single or multiple data items deployed by the service operation.

None 0

未授权访问服务操作。No authorization to access the service operation.

OverrideEntitySetRights 4

使用服务操作权限重写在数据服务中显式定义的实体集权限。Overrides entity set rights that are explicitly defined in the data service with the service operation rights.

ReadMultiple 2

授予通过使用服务操作读取多个数据项。Authorization to read multiple data items by using the service operation.

ReadSingle 1

授予通过使用服务操作读取一个数据项。Authorization to read a single data item by using the service operation.


下面的示例设置对服务操作OrdersByCity的所有权限访问。The following example sets all rights access to the service operation OrdersByCity.

namespace AccountingServiceWebApp  
  public class AccountingService : DataService<DataModel>  
      public static void InitializeService(IDataServiceConfiguration config)  
          config.SetServiceOperationAccessRule("OrdersInCity", ServiceOperationRights.All);  
      public IQueryable<Orders> OrdersByCity(string city)  
          return this.CurrentDataSource.Orders.Where(o => o.ShippingCity == city);