0
|
1 using System;
|
|
2 using System.Data.Metadata.Edm;
|
|
3 using System.Data.Objects;
|
|
4 using System.Data.Services;
|
|
5 using System.Data.Services.Common;
|
|
6
|
|
7 namespace NorthwindDataService
|
|
8 {
|
|
9 public class EFDataService : DataService<NorthwindEntities>
|
|
10 {
|
|
11 // This method is called only once to initialize service-wide policies.
|
|
12 public static void InitializeService(DataServiceConfiguration config)
|
|
13 {
|
|
14 var w = new MetadataWorkspace();
|
|
15 var m = new ObjectStateManager(w);
|
|
16
|
|
17 // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
|
|
18 // Examples:
|
|
19 config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
|
|
20 // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
|
|
21 config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
|
|
22 }
|
|
23 }
|
|
24 }
|