Ejemplo n.º 1
0
        //<snippetDataServiceConfigComplete>
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            //<snippetDataServiceConfig>
            // Set the access rules of feeds exposed by the data service, which is
            // based on the requirements of client applications.
            config.SetEntitySetAccessRule("Customers", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Employees", EntitySetRights.ReadSingle);
            config.SetEntitySetAccessRule("Orders", EntitySetRights.All
                                          | EntitySetRights.WriteAppend
                                          | EntitySetRights.WriteMerge);
            config.SetEntitySetAccessRule("Order_Details", EntitySetRights.All);
            config.SetEntitySetAccessRule("Products", EntitySetRights.All);
            //</snippetDataServiceConfig>

            //<snippetDataServiceConfigPaging>
            // Set page size defaults for the data service.
            config.SetEntitySetPageSize("Orders", 20);
            config.SetEntitySetPageSize("Order_Details", 50);
            config.SetEntitySetPageSize("Products", 50);

            // Paging requires v2 of the OData protocol.
            config.DataServiceBehavior.MaxProtocolVersion =
                System.Data.Services.Common.DataServiceProtocolVersion.V2;
            //</snippetDataServiceConfigPaging>
        }
Ejemplo n.º 2
0
        // 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);
        }
Ejemplo n.º 3
0
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("Ladies", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Gentlemen", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Towns", EntitySetRights.AllRead);

            config.SetEntitySetPageSize("Ladies", 10);
            config.SetEntitySetPageSize("Gentlemen", 10);
            config.SetEntitySetPageSize("Towns", 10);

            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
        }
Ejemplo n.º 4
0
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("Employees", EntitySetRights.All);
            config.SetEntitySetPageSize("Employees", 20);
            config.SetEntitySetAccessRule("Projects", EntitySetRights.All);
            config.SetEntitySetPageSize("Projects", 20);
            config.SetEntitySetAccessRule("Users", EntitySetRights.All);
            config.SetEntitySetAccessRule("Roles", EntitySetRights.All);

            config.UseVerboseErrors = true;
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }
Ejemplo n.º 5
0
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;

            //config.SetEntitySetAccessRule("Contatos", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);

            config.SetServiceOperationAccessRule("GetCliente", ServiceOperationRights.ReadSingle);

            //config.MaxExpandDepth = 1;
            //config.MaxExpandCount = 1;
            config.SetEntitySetPageSize("Clientes", 5);
            config.SetEntitySetPageSize("Enderecos", 10);
        }
Ejemplo n.º 6
0
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.UseVerboseErrors = true;
            config.DataServiceBehavior.AcceptSpatialLiteralsInQuery = false;
            config.DataServiceBehavior.MaxProtocolVersion           = Microsoft.OData.Client.ODataProtocolVersion.V4;
            config.SetEntitySetAccessRule("*", Microsoft.OData.Service.EntitySetRights.All);
            config.SetServiceActionAccessRule("*", Microsoft.OData.Service.ServiceActionRights.Invoke);
            config.SetServiceOperationAccessRule("*", Microsoft.OData.Service.ServiceOperationRights.All);

            config.SetEntitySetPageSize("Customer", 2);
            config.SetEntitySetPageSize("Order", 2);

            config.RegisterKnownType(typeof(ComplexWithAllPrimitiveTypes));
            config.EnableTypeAccess("*");
        }
Ejemplo n.º 7
0
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.SetEntitySetPageSize("*", 1000);
     config.SetEntitySetAccessRule("DeletedItems", EntitySetRights.AllRead);
 }
Ejemplo n.º 8
0
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.DataServiceBehavior.MaxProtocolVersion       = DataServiceProtocolVersion.V3;
     config.DataServiceBehavior.AcceptProjectionRequests = true;
     config.UseVerboseErrors = true;
     config.SetEntitySetPageSize("*", DataServiceController.Current.Configuration.GetResultSetLimit("*"));
     foreach (DSConfiguration.WcfConfigElement entitySet in DataServiceController.Current.Configuration.DataServicesConfig.EntitySets)
     {
         config.SetEntitySetPageSize(entitySet.Name, entitySet.MaxResults);
     }
     config.MaxExpandCount = DataServiceController.Current.Configuration.DataServicesConfig.MaxExpandCount;
     config.MaxExpandDepth = DataServiceController.Current.Configuration.DataServicesConfig.MaxExpandDepth;
     config.DataServiceBehavior.AcceptAnyAllRequests         = true;
     config.DataServiceBehavior.AcceptSpatialLiteralsInQuery = false;
 }
Ejemplo n.º 9
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;
        }
Ejemplo n.º 10
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);
 }
Ejemplo n.º 11
0
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.SetEntitySetPageSize("*", 100);
     config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
     config.UseVerboseErrors = true;
 }
Ejemplo n.º 12
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;
 }
Ejemplo n.º 13
0
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.DataServiceBehavior.MaxProtocolVersion = ODataProtocolVersion.V4;
     config.DataServiceBehavior.UrlConventions     = DataServiceUrlConventions.KeyAsSegment;
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.SetEntitySetPageSize("*", 2);
     config.DataServiceBehavior.IncludeAssociationLinksInResponse = true;
 }
Ejemplo n.º 14
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;
 }
Ejemplo n.º 15
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;
 }
Ejemplo n.º 16
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.AllRead);
            config.SetEntitySetPageSize("*", 4000);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.UseVerboseErrors = true;
            config.DataServiceBehavior.AcceptSpatialLiteralsInQuery = false;
            config.DataServiceBehavior.MaxProtocolVersion           = System.Data.Services.Common.DataServiceProtocolVersion.V3;
            config.SetEntitySetAccessRule("*", System.Data.Services.EntitySetRights.All);
            config.SetEntitySetAccessRule("MappedEntityType", EntitySetRights.None);
            config.SetEntitySetAccessRule("Message", EntitySetRights.AllRead);

            config.SetServiceActionAccessRule("*", System.Data.Services.ServiceActionRights.Invoke);
            config.SetServiceOperationAccessRule("*", System.Data.Services.ServiceOperationRights.All);

            config.SetEntitySetPageSize("Customer", 2);
            config.SetEntitySetPageSize("Order", 2);

            config.RegisterKnownType(typeof(ComplexWithAllPrimitiveTypes));
            config.EnableTypeAccess("*");
        }
Ejemplo n.º 18
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;
 }
Ejemplo n.º 19
0
 // 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"])
                                 );
 }
Ejemplo n.º 20
0
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.UseVerboseErrors = true;
     // This is only a sample service that does not have any security.
     // Any production service will typically enforce some kind if security.
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.DataServiceBehavior.AcceptCountRequests      = true;
     config.DataServiceBehavior.AcceptProjectionRequests = true;
     config.SetEntitySetPageSize("*", 5);
     config.DataServiceBehavior.MaxProtocolVersion = System.Data.Services.Common.DataServiceProtocolVersion.V2;
 }
Ejemplo n.º 21
0
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("Presidents", EntitySetRights.AllRead);

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

            config.SetEntitySetPageSize("Presidents", 10);

            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }
Ejemplo n.º 22
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("Users", EntitySetRights.AllRead);
            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            config.SetEntitySetPageSize("*", 50);

#if DEBUG
            config.UseVerboseErrors = true;
#endif
            config.DataServiceBehavior.IncludeAssociationLinksInResponse = true;
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }
        public static void InitializeService(DataServiceConfiguration config)
        {
            /*The 10 Top Jobs can be returned eaither by using
             *  this URL( notice that  Query options $expand, $filter, $orderby, $skip and $top can be applied as well)
             *  http://localhost/TopTenWcfDataService.svc/Get10TopJobs
             *  or By using this URL directly:
             *   http://localhost/TopTenWcfDataService.svc/Jobs
             */
            config.SetEntitySetAccessRule("Jobs", EntitySetRights.All);
            config.SetServiceOperationAccessRule("Get10TopJobs", ServiceOperationRights.AllRead);

            config.SetEntitySetPageSize("*", 25);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
        }
Ejemplo n.º 24
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
        }
Ejemplo n.º 25
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);

            // Give readonly access to all of the entities
            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            config.UseVerboseErrors = true;

            // Pagesize will change the max number of rows returned
            config.SetEntitySetPageSize("*", 10);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }
Ejemplo n.º 26
0
        /// <summary>
        /// This method is called only once to initialize service-wide policies.
        /// </summary>
        /// <param name="config">The data service configurations.</param>
        public static void InitializeService(DataServiceConfiguration config)
        {
            // Examples:
            // config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead);
            // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);

            config.UseVerboseErrors = true;
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            int entityPageSize;

            if (!Int32.TryParse(ConfigurationManager.AppSettings["EntityPageSize"], out entityPageSize))
            {
                entityPageSize = DefaultPageSize;
            }
            config.SetEntitySetPageSize("*", entityPageSize);
        }
Ejemplo n.º 27
0
 // This method is called only once to initialize service-wide policies.
 public static void InitializeService(DataServiceConfiguration config)
 {
     config.UseVerboseErrors = true;
     config.SetEntitySetAccessRule("*", EntitySetRights.All);
     config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
     config.SetEntitySetPageSize("Products", 500);
     config.SetEntitySetPageSize("ProductInfos", 500);
     config.SetEntitySetPageSize("Customers", 500);
     config.SetEntitySetPageSize("CustomerInfos", 500);
     config.SetEntitySetPageSize("CustomerOrders", 500);
     config.SetEntitySetPageSize("OrderLines", 500);
     config.DataServiceBehavior.MaxProtocolVersion       = DataServiceProtocolVersion.V3;
     config.DataServiceBehavior.AcceptProjectionRequests = true;
 }
Ejemplo n.º 28
0
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("*", 3);
            config.UseVerboseErrors = Global.GetAppSettingAsBool("IncludeVerboseErrorsInReponse", false);
            config.DataServiceBehavior.MaxProtocolVersion = 2;
            int num;

            if (!int.TryParse(ConfigurationManager.AppSettings["EntitysetPageSize"], out num))
            {
                num = 1000;
            }
            config.SetEntitySetPageSize("*", num);
            config.AnnotationsBuilder = new Func <IEdmModel, IEnumerable <IEdmModel> >(ReportingService.BuildAnnotations);
            bool flag;

            bool.TryParse(ConfigurationManager.AppSettings[ReportingService.AppSettingEnableRwsVersionZeroKey], out flag);
            if (flag)
            {
                ReportingVersion.EnableVersionZero();
            }
        }
Ejemplo n.º 29
0
        public static void InitializeService(DataServiceConfiguration config)
        {
            // Person-related entries can be changed using this service.
            // To add or remove, client needs to use the CustomerManagement service instead.
            // This ensures proper associations are maintained.
            var readAndEdit = EntitySetRights.AllRead | EntitySetRights.WriteMerge;

            config.SetEntitySetAccessRule("People", readAndEdit);
            config.SetEntitySetAccessRule("EmailAddresses", readAndEdit);
            config.SetEntitySetAccessRule("PersonPhones", readAndEdit);
            config.SetEntitySetAccessRule("PersonCreditCards", readAndEdit);
            config.SetEntitySetAccessRule("CreditCards", readAndEdit);

            // Person records themselves are paged 25 at a time
            config.SetEntitySetPageSize("People", 25);

            // Otherwise default to read-only
            config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;

            ServerAppInsights.Client.TrackEvent("DataServiceStartup");
        }
Ejemplo n.º 30
0
 private static void PageSizeCustomizerFast(DataServiceConfiguration config)
 {
     config.SetEntitySetPageSize("*", 5);
     config.SetEntitySetPageSize("Customers", 30);
 }