/// <summary>Called to initialize the service on a given request.</summary> /// <param name="request">The request which was not yet used for the service to initialize on.</param> protected override void InitializeService(TestWebRequest request) { // For now we use the settings class to maintain backward compatibility. // Once all the tests are migrated to the new service definition behavior, we could get rid of the settings class // and use the service definition Current directly. base.InitializeService(request); request.RegisterForDispose(test.TestUtil.MetadataCacheCleaner()); ApplySetting(request, OpenWebDataServiceHelper.EnableAccess, this.EnableAccess); ApplySetting(request, OpenWebDataServiceHelper.DisableValidationOnMetadataWrite, this.DisableValidationOnMetadataWrite); if (this.EnableTypeConversion.HasValue) { ApplySetting(request, OpenWebDataServiceHelper.EnableTypeConversion, this.EnableTypeConversion.Value); } if (this.DataServiceBehavior.InvokeInterceptorsOnLinkDelete.HasValue) { ApplySetting(request, OpenWebDataServiceHelper.InvokeInterceptorsOnLinkDelete, this.DataServiceBehavior.InvokeInterceptorsOnLinkDelete.Value); } if (this.DataServiceBehavior.AcceptCountRequests.HasValue) { ApplySetting(request, OpenWebDataServiceHelper.AcceptCountRequests, this.DataServiceBehavior.AcceptCountRequests.Value); } if (this.DataServiceBehavior.AcceptProjectionRequests.HasValue) { ApplySetting(request, OpenWebDataServiceHelper.AcceptProjectionRequests, this.DataServiceBehavior.AcceptProjectionRequests.Value); } if (this.DataServiceBehavior.MaxProtocolVersion.HasValue) { ApplySetting(request, OpenWebDataServiceHelper.MaxProtocolVersion, this.DataServiceBehavior.MaxProtocolVersion.Value); } if (this.DataServiceBehavior.IncludeRelationshipLinksInResponse.HasValue) { ApplySetting(request, OpenWebDataServiceHelper.IncludeRelationshipLinksInResponse, this.DataServiceBehavior.IncludeRelationshipLinksInResponse.Value); } if (this.DataServiceBehavior.UseMetadataKeyOrderForBuiltInProviders.HasValue) { ApplySetting(request, OpenWebDataServiceHelper.UseMetadataKeyOrderForBuiltInProviders, this.DataServiceBehavior.UseMetadataKeyOrderForBuiltInProviders.Value); } if (this.DataServiceBehavior.AcceptSpatialLiteralsInQuery.HasValue) { ApplySetting(request, OpenWebDataServiceHelper.AcceptSpatialLiteralsInQuery, this.DataServiceBehavior.AcceptSpatialLiteralsInQuery.Value); } if (this.MaxResultsPerCollection.HasValue) { ApplySetting(request, OpenWebDataServiceHelper.MaxResultsPerCollection, this.MaxResultsPerCollection); } ApplySetting(request, OpenWebDataServiceHelper.ProcessingRequest, this.ProcessingPipeline.ProcessingRequest); ApplySetting(request, OpenWebDataServiceHelper.ProcessedRequest, this.ProcessingPipeline.ProcessedRequest); ApplySetting(request, OpenWebDataServiceHelper.ProcessingChangeset, this.ProcessingPipeline.ProcessingChangeset); ApplySetting(request, OpenWebDataServiceHelper.ProcessedChangeset, this.ProcessingPipeline.ProcessedChangeset); request.RegisterForDispose(System.Data.Test.Astoria.TestUtil.RestoreStaticValueOnDispose(typeof(OpenWebDataServiceHelper), "ForceVerboseErrors")); OpenWebDataServiceHelper.ForceVerboseErrors = this.ForceVerboseErrors; ApplySetting(request, OpenWebDataServiceHelper.ServiceConstructorCallback, this.ServiceConstructionCallback); ApplySetting(request, OpenWebDataServiceHelper.PageSizeCustomizer, this.PageSizeCustomizer); ApplySetting(request, OpenWebDataServiceHelper.EntitySetAccessRule, this.EntitySetAccessRule); ApplySetting(request, OpenWebDataServiceHelper.ServiceOperationAccessRule, this.ServiceOperationAccessRule); ApplySetting(request, OpenWebDataServiceHelper.EnableFriendlyFeeds, this.EnableFriendlyFeeds); }
/// <summary>Starts the service for the specified location and returns a new TestWebRequest pointing to that service.</summary> /// <param name="location">The location where to start the service.</param> /// <returns>The newly created TestWebRequest.</returns> public TestWebRequest CreateForLocation(test.WebServerLocation location) { Debug.Assert(current == null, "Can't have two instances of TestWebRequest against any service definition at any given time."); Debug.Assert( (this.ServiceType == null || this.DataServiceType == null) && (this.DataServiceType != null || this.ServiceType != null), "Either DataServiceType or ServiceType must not be null, but only one can be specified."); TestWebRequest request = TestWebRequest.CreateForLocation(location); if (this.DataServiceType != null) { request.DataServiceType = this.DataServiceType; } else { request.ServiceType = this.ServiceType; } current = this; current.InitializeService(request); request.RegisterForDispose(() => { current = null; }); return(request); }
/// <summary>Called to initialize the service on a given request.</summary> /// <param name="request">The request which was not yet used for the service to initialize on.</param> virtual protected void InitializeService(TestWebRequest request) { request.RegisterForDispose(System.Data.Test.Astoria.TestUtil.RestoreStaticValueOnDispose(typeof(System.Data.Test.Astoria.BaseTestWebRequest), "HostInterfaceType")); System.Data.Test.Astoria.BaseTestWebRequest.HostInterfaceType = this.HostInterfaceType; }
/// <summary>Called to initialize the service on a given request.</summary> /// <param name="request">The request which was not yet used for the service to initialize on.</param> protected override void InitializeService(TestWebRequest request) { // Create the table and populate it with data. Register for cleanup as well. request.RegisterForDispose(ocs.PopulateData.CreateTableAndPopulateData()); }
internal static void ApplySetting <T>(TestWebRequest request, test.Restorable <T> restorable, T value) { request.RegisterForDispose(restorable.Restore()); restorable.Value = value; }
/// <summary>Called to initialize the service on a given request.</summary> /// <param name="request">The request which was not yet used for the service to initialize on.</param> protected override void InitializeService(TestWebRequest request) { // Create the table and populate it with data. Register for cleanup as well. request.RegisterForDispose(ocs.PopulateData.CreateTableAndPopulateData()); }
/// <summary>Called to initialize the service on a given request.</summary> /// <param name="request">The request which was not yet used for the service to initialize on.</param> virtual protected void InitializeService(TestWebRequest request) { request.RegisterForDispose(System.Data.Test.Astoria.TestUtil.RestoreStaticValueOnDispose(typeof(System.Data.Test.Astoria.BaseTestWebRequest), "HostInterfaceType")); System.Data.Test.Astoria.BaseTestWebRequest.HostInterfaceType = this.HostInterfaceType; }
/// <summary>Called to initialize the service on a given request.</summary> /// <param name="request">The request which was not yet used for the service to initialize on.</param> protected override void InitializeService(TestWebRequest request) { base.InitializeService(request); request.RegisterForDispose(() => { this.currentDataSource = null; }); }