コード例 #1
0
 // This method is called only once to initialize service-wide policies.
 protected static void InitializeServiceBase(DataServiceConfiguration config)
 {
     config.SetServiceOperationAccessRule("Search", ServiceOperationRights.AllRead);
     config.SetServiceOperationAccessRule("FindPackagesById", ServiceOperationRights.AllRead);
     config.SetEntitySetAccessRule("Packages", EntitySetRights.AllRead);
     config.SetEntitySetPageSize("Packages", MaxPageSize);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
     config.UseVerboseErrors = true;
 }
コード例 #2
0
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetPageSize("*", 100);
     config.SetEntitySetAccessRule("Dinners", EntitySetRights.AllRead);
     config.SetEntitySetAccessRule("RSVPs", EntitySetRights.AllRead);
     config.SetServiceOperationAccessRule("DinnersNearMe", ServiceOperationRights.AllRead);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
 }
コード例 #3
0
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
     // Examples:
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.SetServiceOperationAccessRule("AllEmployees", ServiceOperationRights.All);
     config.SetServiceOperationAccessRule("EmployeesByID", ServiceOperationRights.All);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
 }
コード例 #4
0
ファイル: northwind2.svc.cs プロジェクト: zhimaqiao51/docs
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("Employees", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Customers", EntitySetRights.All);
            config.SetEntitySetAccessRule("Orders", EntitySetRights.All);
            config.SetEntitySetAccessRule("Order_Details", EntitySetRights.All);
            config.SetEntitySetAccessRule("Products", EntitySetRights.All);
            config.UseVerboseErrors = true;
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;

            //<snippetServiceOperationConfig>
            config.SetServiceOperationAccessRule(
                "GetOrdersByCity", ServiceOperationRights.AllRead);
            //</snippetServiceOperationConfig>

            config.SetServiceOperationAccessRule("RaiseError", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("GetNewestOrder", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("CountOpenOrders", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("ReturnsNoData", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("GetCustomerNames", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("GetCustomerNamesPost", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("CloneCustomer", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("GetOrdersByState", ServiceOperationRights.AllRead);
            config.SetEntitySetPageSize("Customers", 10);
            config.SetEntitySetPageSize("Orders", 10);
        }
コード例 #5
0
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            // Enable access to entity sets and service operations.
            config.SetEntitySetAccessRule("Orders", EntitySetRights.AllRead | EntitySetRights.AllWrite);
            config.SetEntitySetAccessRule("Order_Details", EntitySetRights.AllRead | EntitySetRights.AllWrite);
            config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
            config.SetServiceOperationAccessRule("RegisterForPushNotifications", ServiceOperationRights.ReadSingle);
            config.SetServiceOperationAccessRule("DeleteRegistrations", ServiceOperationRights.ReadSingle);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;

            //// Use for debugging.
            //config.UseVerboseErrors = true;
        }
コード例 #6
0
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
            // Examples:
            // config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead);
            // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);

            config.UseVerboseErrors = true;

            // Entity Sets
            config.SetEntitySetAccessRule("Conditions", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("EducationalMaterialsFAQs", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Medications", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("MedicationConditions", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Sites", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Studies", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("StudyConditions", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("StudySites", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Users", EntitySetRights.AllRead | EntitySetRights.AllWrite);
            config.SetEntitySetAccessRule("UserAccessLogs", EntitySetRights.AllWrite);
            config.SetEntitySetAccessRule("UserConditions", EntitySetRights.AllRead | EntitySetRights.AllWrite);
            config.SetEntitySetAccessRule("UserMedications", EntitySetRights.AllRead | EntitySetRights.AllWrite);
            config.SetEntitySetAccessRule("UserSearches", EntitySetRights.AllRead | EntitySetRights.AllWrite);
            config.SetEntitySetAccessRule("UserStudies", EntitySetRights.AllRead | EntitySetRights.AllWrite);
            config.SetEntitySetAccessRule("Countries", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("StateProvinces", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("MedInfoConditions", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("MedInfoDrugs", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("MedInfoDrugConditions", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("SearchStudies", EntitySetRights.AllRead);

            // View Sets
            config.SetEntitySetAccessRule("vw_GetAlerts", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("vw_SearchMedications", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("vw_SavedStudies", EntitySetRights.AllRead);

            //// Stored Procedure Result Sets
            config.SetEntitySetAccessRule("USP_SearchMedicationsResults", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("USP_GetNewItemCountsResults", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("USP_GetAlertsResults", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("USP_SearchStudiesResults", EntitySetRights.AllRead);

            // Service Operation Sets
            config.SetServiceOperationAccessRule("GetStudies", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("GetMedications", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("GetNewItemCounts", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("GetAlerts", ServiceOperationRights.AllRead);

            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }
コード例 #7
0
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            //We have thousands of rows so setup server-page
            config.SetEntitySetPageSize("*", 100);

            // We're exposing both Dinners and RSVPs for read
            config.SetEntitySetAccessRule("Dinners", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("RSVPs", EntitySetRights.AllRead);
            config.SetServiceOperationAccessRule("DinnersNearMe", ServiceOperationRights.AllRead);
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
            #if DEBUG
            config.UseVerboseErrors = true;
            #endif
        }
コード例 #8
0
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("ValidationJobs", EntitySetRights.ReadSingle);
     config.SetEntitySetAccessRule("ExtValidationJobs", EntitySetRights.ReadSingle | EntitySetRights.WriteAppend);
     config.SetEntitySetAccessRule("JobGroups", EntitySetRights.AllRead);
     config.SetEntitySetAccessRule("TestResults", EntitySetRights.AllRead);
     config.SetEntitySetAccessRule("PayloadLines", EntitySetRights.ReadMultiple);
     config.SetEntitySetAccessRule("ResultDetails", EntitySetRights.AllRead);
     config.SetServiceOperationAccessRule("UriValidationJobs", ServiceOperationRights.ReadMultiple);
     config.SetServiceOperationAccessRule("ConformanceRerunJob", ServiceOperationRights.ReadMultiple);
     config.SetServiceOperationAccessRule("SimpleRerunJob", ServiceOperationRights.ReadMultiple);
     config.SetServiceOperationAccessRule("Reload", ServiceOperationRights.ReadMultiple);
     config.SetEntitySetAccessRule("Records", EntitySetRights.ReadSingle | EntitySetRights.WriteAppend);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
     config.UseVerboseErrors = true;
 }
コード例 #9
0
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("Menus", EntitySetRights.AllRead);
     config.SetEntitySetAccessRule("Categories", EntitySetRights.AllRead);
     config.SetServiceOperationAccessRule("GetMenusByName", ServiceOperationRights.AllRead);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
 }
コード例 #10
0
        // 仅调用此方法一次以初始化涉及服务范围的策略。
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);



            // 上面是 允许全部访问的 代码
            // 实际应用中, 这么写, 是不合适的.


            // ========================================

            //public void SetEntitySetAccessRule(
            //    string name,
            //    EntitySetRights rights
            //)
            // name : 要为其设置权限的实体集的名称
            // rights : 要授予此资源的访问权限


            // EntitySetRights 枚举
            //成员名称		说明
            //None			拒绝所有数据访问权限。
            //ReadSingle		授权读取单一数据项。
            //ReadMultiple	授权读取数据集。
            //WriteAppend		授权在数据集中创建新数据项。
            //WriteReplace	授权替换数据。
            //WriteDelete		授权从数据集中删除数据项。
            //WriteMerge		授权合并数据。
            //AllRead			授权读取数据。
            //AllWrite		授权写入数据。
            //All				授权创建、读取、更新和删除数据。


            // ========================================



            //public void SetServiceOperationAccessRule(
            //    string name,
            //    ServiceOperationRights rights
            //)
            // name : 要为其设置权限的服务操作的名称。
            // rights : 要授予此资源的访问权限,可作为 ServiceOperationRights 值传递。


            // ServiceOperationRights 枚举
            //成员名称					说明
            //None						未授权访问服务操作。
            //ReadSingle					授予通过使用服务操作读取一个数据项。
            //ReadMultiple				授予通过使用服务操作读取多个数据项。
            //AllRead						授权读取服务操作所部署的一个或多个数据项。
            //All							分配给服务操作的所有权限。
            //OverrideEntitySetRights		使用服务操作权限重写在数据服务中显式定义的实体集权限。



            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
        }
コード例 #11
0
 // This method is called only once to initialize service-wide policies.
 // This is the version with the context out of the box
 // All CRUD methods implemented
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("Joke", EntitySetRights.All);
     config.UseVerboseErrors = true;
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
     config.SetServiceOperationAccessRule("GradeOrdered", ServiceOperationRights.All);
 }
コード例 #12
0
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     // Set rules to indicate which entity sets and service operations are visible, updatable, etc.
     config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
     config.SetServiceOperationAccessRule("GetSuppliersLiteZip", ServiceOperationRights.All);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
 }
コード例 #13
0
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("Events", EntitySetRights.AllRead);
     config.SetEntitySetAccessRule("Attendees", EntitySetRights.All);
     config.SetServiceOperationAccessRule("AddAttendee", ServiceOperationRights.All);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
 }
コード例 #14
0
 /// <summary>
 /// Initialize the service
 /// </summary>
 /// <param name="config"></param>
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.DataServiceBehavior.MaxProtocolVersion = ODataProtocolVersion.V4;
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.SetEntitySetPageSize("*", 10);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
 }
コード例 #15
0
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
     //config.SetEntitySetAccessRule("NerdDinnerLogin", EntitySetRights.None);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
 }
コード例 #16
0
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     Configure(config);
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.AllRead);
     config.UseVerboseErrors = true;
 }
コード例 #17
0
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
     // Examples:
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
 }
コード例 #18
0
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
     config.DataServiceBehavior.MaxProtocolVersion = ODataProtocolVersion.V4;
     config.UseVerboseErrors = true;
 }
コード例 #19
0
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("Announcements", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Sponsors", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Timeslots", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Tracks", EntitySetRights.AllRead);


            config.SetEntitySetAccessRule("Sessions", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("SessionAttendees", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("People", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Tasks", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Announcements", EntitySetRights.AllRead);

            config.SetEntitySetPageSize("SessionAttendees", 50);

            config.SetServiceOperationAccessRule("Speakers", ServiceOperationRights.AllRead);

            config.SetEntitySetAccessRule("Tags", EntitySetRights.AllRead);

            // remove before deployment
            config.UseVerboseErrors = true;

            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
        }
コード例 #20
0
 /// <summary>
 /// Initialize the service
 /// </summary>
 /// <param name="config">The data service configuration</param>
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.SetEntitySetPageSize("*", 10);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
     config.DisableValidationOnMetadataWrite = true;
 }
コード例 #21
0
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
     config.UseVerboseErrors = true;
 }
コード例 #22
0
 /// <summary>
 /// Initializes an answer file data service.
 /// </summary>
 /// <param name="config">The configuration of the answer file data service.</param>
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
     config.SetServiceOperationAccessRule(DefineAnswerFileDataSourceOperationName, ServiceOperationRights.ReadSingle);
     config.SetEntitySetPageSize("*", 100);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
     //config.DataServiceBehavior.AcceptProjectionRequests = true;
 }
コード例 #23
0
 // 仅调用此方法一次以初始化涉及服务范围的策略。
 public static void InitializeService(DataServiceConfiguration config)
 {
     // TODO: 设置规则以指明哪些实体集和服务操作是可见的、可更新的,等等。
     // 示例:
     config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
 }
コード例 #24
0
ファイル: BatchTestUtil.cs プロジェクト: zhonli/odata.net
 public static void InitializeService(DataServiceConfiguration configuration)
 {
     configuration.SetEntitySetAccessRule("*", EntitySetRights.All);
     configuration.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
     configuration.SetServiceActionAccessRule("*", ServiceActionRights.Invoke);
     configuration.UseVerboseErrors = OpenWebDataServiceHelper.ForceVerboseErrors;
     configuration.DataServiceBehavior.MaxProtocolVersion = ODataProtocolVersion.V4;
 }
コード例 #25
0
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.UseVerboseErrors = true;
     config.MaxExpandCount   = 300;
     config.MaxExpandDepth   = 300;
     config.SetEntitySetAccessRule("*", EntitySetRights.AllRead | EntitySetRights.WriteMerge | EntitySetRights.WriteReplace);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.AllRead);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
 }
コード例 #26
0
 //private LogInEntities _context = null;
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
     //I noticed when setting page size it would always limit my expand payload to 1
     //I have elected to disable paging...
     //config.SetEntitySetPageSize("*", 50);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
 }
コード例 #27
0
        public static void InitializeService(DataServiceConfiguration config)
        {
            Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");

            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
            config.UseVerboseErrors = true;
        }
コード例 #28
0
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
     config.DataServiceBehavior.MaxProtocolVersion       = System.Data.Services.Common.DataServiceProtocolVersion.V3;
     config.DataServiceBehavior.AcceptCountRequests      = true;
     config.DataServiceBehavior.AcceptProjectionRequests = true;
     config.UseVerboseErrors = true;
 }
コード例 #29
0
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);

            //config.SetEntitySetAccessRule("Products", EntitySetRights.AllRead);
            //config.SetEntitySetAccessRule("Categories", EntitySetRights.AllRead);

            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }
コード例 #30
0
ファイル: MFiles.svc.cs プロジェクト: mazurov/BRS-MFiles
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.AllRead);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
     config.UseVerboseErrors = true;
     config.SetEntitySetPageSize("*",
                                 Convert.ToInt32(WebConfigurationManager.AppSettings["AllEntitiesPageSize"])
                                 );
 }