Ανάγνωση στα Αγγλικά Επεξεργασία

Κοινή χρήση μέσω


DataServiceConfiguration.SetEntitySetAccessRule Method

Definition

Sets the permissions for the specified entity set resource.

public void SetEntitySetAccessRule (string name, System.Data.Services.EntitySetRights rights);

Parameters

name
String

Name of the entity set for which to set permissions.

rights
EntitySetRights

Access rights to be granted to this resource, passed as an EntitySetRights value.

Implements

Examples

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

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

Remarks

When you specify a value of an asterisk (*) for the name parameter, permissions are set for all entity sets that do not have the permissions explicitly set.

Applies to

Προϊόν Εκδόσεις
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also