当前位置: 首页>>代码示例>>C#>>正文


C# IRequestFactory类代码示例

本文整理汇总了C#中IRequestFactory的典型用法代码示例。如果您正苦于以下问题:C# IRequestFactory类的具体用法?C# IRequestFactory怎么用?C# IRequestFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IRequestFactory类属于命名空间,在下文中一共展示了IRequestFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        public static RequestInfo Create(
            RequestMethod method, string target, string uriTemplate, Dictionary<string, object> parameters,
            string userAgent, Dictionary<string, string> headers, ContentType requestContentType,
            ContentType responseContentType, TimeSpan cacheDuration,
            int timeout, int retryCount,
            Uri uri, string requestBody, IRequestFactory requestFactory)
        {
            var result = new RequestInfo
                             {
                                 Target = target,
                                 UriTemplate = uriTemplate,
                                 AllowedRetries = retryCount,
                                 Uri = uri,
                                 Method = method,
                                 UserAgent = userAgent,
                                 _headers = new Dictionary<string, string>(headers ?? new Dictionary<string, string>()),
                                 RequestBody = requestBody,
                                 Parameters = new Dictionary<string, object>(parameters ?? new Dictionary<string, object>()),
                                 CacheDuration = cacheDuration,
                                 RequestContentType = requestContentType,
                                 ResponseContentType = responseContentType,
                                 Timeout = timeout
                             };

            return result;
        }
开发者ID:bitpusher,项目名称:Salient.ReliableHttpClient,代码行数:26,代码来源:RequestInfo.cs

示例2: SetUp

 public void SetUp()
 {
     factory = Substitute.For<IRequestFactory>();
     factory.CreateClient().Execute(factory.CreateRequest()).StatusCode = HttpStatusCode.OK;
     descendant = new OAuthClientDescendant(
         factory, Substitute.For<IClientConfiguration>());
 }
开发者ID:kekekeks,项目名称:OAuth2,代码行数:7,代码来源:OAuthClientTests.cs

示例3: Client

        public Client(Uri rpcUri, Uri streamingUri, string appKey,IJsonSerializer serializer, IRequestFactory factory)
            : base(serializer, factory)
        {
	#if SILVERLIGHT
	#if WINDOWS_PHONE
	        UserAgent = "CIAPI.PHONE7."+ GetVersionNumber();
	#else
	        UserAgent = "CIAPI.SILVERLIGHT."+ GetVersionNumber();
	#endif
	#else
	        UserAgent = "CIAPI.CS." + GetVersionNumber();
	#endif
        AppKey=appKey;
        _client=this;
        _rootUri = rpcUri;
        _streamingUri = streamingUri;

            this. Authentication = new _Authentication(this);
            this. PriceHistory = new _PriceHistory(this);
            this. News = new _News(this);
            this. CFDMarkets = new _CFDMarkets(this);
            this. SpreadMarkets = new _SpreadMarkets(this);
            this. Market = new _Market(this);
            this. Preference = new _Preference(this);
            this. TradesAndOrders = new _TradesAndOrders(this);
            this. AccountInformation = new _AccountInformation(this);
            this. Messaging = new _Messaging(this);
            this. Watchlist = new _Watchlist(this);
            this. ClientApplication = new _ClientApplication(this);
            this. ExceptionHandling = new _ExceptionHandling(this);
        Log.Debug("Rpc.Client created for " + _rootUri.AbsoluteUri);
        }
开发者ID:MarcRichomme,项目名称:CIAPI.CS,代码行数:32,代码来源:Routes.cs

示例4: DeviceLocator

 public DeviceLocator(ISocketFactory socketFactory, IRequestFactory requestFactory, IMessageParser messageParser, IDeviceInfoCollector deviceInfoCollector)
 {
     _socketFactory = socketFactory;
     _requestFactory = requestFactory;
     _messageParser = messageParser;
     _deviceInfoCollector = deviceInfoCollector;
 }
开发者ID:estaphorsius,项目名称:devicedisco,代码行数:7,代码来源:DeviceLocator.cs

示例5: SetUp

 public void SetUp()
 {
     requestFactory = Substitute.For<IRequestFactory>();
     requestFactory.CreateClient().Execute(requestFactory.CreateRequest()).StatusCode = HttpStatusCode.OK;
     descendant = new DigitalOceanClientDescendant(
         requestFactory, Substitute.For<IClientConfiguration>());
 }
开发者ID:titarenko,项目名称:OAuth2,代码行数:7,代码来源:DigitalOceanClientTests.cs

示例6: RpcClient

 public RpcClient(Uri uri, Uri streamingUri, IRequestCache cache, IRequestFactory requestFactory,IStreamingConnectionFactory streamingConnectionFactory,
                  Dictionary<string, IThrottedRequestQueue> throttleScopes, int retryCount)
     : base(uri, cache, requestFactory, throttleScopes, retryCount)
 {
     _streamingConnectionFactory = streamingConnectionFactory;
     _streamingUri = streamingUri;
 }
开发者ID:psrodriguez,项目名称:CIAPI.CS,代码行数:7,代码来源:ApiClientStreaming.cs

示例7: RequestThrottle

 public RequestThrottle(IRequestFactory requestFactory, TimeSpan throttleWindowTime, int throttleWindowCount, int maxPendingRequests)
 {
     RequestFactory = requestFactory;
     ThrottleWindowTime = throttleWindowTime;
     ThrottleWindowCount = throttleWindowCount;
     MaxPendingRequests = maxPendingRequests;
 }
开发者ID:psrodriguez,项目名称:CIAPI.CS,代码行数:7,代码来源:RequestThrottle.cs

示例8: Channel

 public Channel(string name, IRequestFactory requestFactory, IJsonSerializer jsonSerializer, IRestClient restClient)
     : base(requestFactory, jsonSerializer, restClient)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentNullException("name");
     }
     _name = name;
 }
开发者ID:Hihaj,项目名称:BeaconpushSharp,代码行数:9,代码来源:Channel.cs

示例9: AuthorizationRoot

 /// <summary>
 /// Initializes a new instance of the <see cref="AuthorizationRoot" /> class.
 /// </summary>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="configurationSectionName">Name of the configuration section.</param>
 /// <param name="requestFactory">The request factory.</param>
 public AuthorizationRoot(
     IConfigurationManager configurationManager, 
     string configurationSectionName, 
     IRequestFactory requestFactory)
 {
     this.requestFactory = requestFactory;
     configurationSection = configurationManager
         .GetConfigSection<OAuth2ConfigurationSection>(configurationSectionName);
 }
开发者ID:Tazer,项目名称:OAuth2,代码行数:15,代码来源:AuthorizationRoot.cs

示例10: User

 public User(string username, IRequestFactory requestFactory, IJsonSerializer jsonSerializer, IRestClient restClient)
     : base(requestFactory, jsonSerializer, restClient)
 {
     if (string.IsNullOrEmpty(username))
     {
         throw new ArgumentNullException("username");
     }
     _username = username;
 }
开发者ID:Hihaj,项目名称:BeaconpushSharp,代码行数:9,代码来源:User.cs

示例11: Connection

        public Connection(IRegistrationService registrationService, IRequestFactory requestFactory, IIrcClientFactory ircClientFactory) : this()
        {
            Contract.Requires<ArgumentNullException>(registrationService != null, "registrationService");
            Contract.Requires<ArgumentNullException>(requestFactory != null, "requestFactory");
            Contract.Requires<ArgumentNullException>(ircClientFactory != null, "ircClientFactory");

            this.registrationService = registrationService;
            this.requestFactory = requestFactory;
            this.ircClientFactory = ircClientFactory;
        }
开发者ID:pjmagee,项目名称:NazureBot,代码行数:10,代码来源:Connection.cs

示例12: FollowLinkAsync

        public static Task<HttpResponseMessage> FollowLinkAsync(
            this System.Net.Http.HttpClient httpClient, 
            IRequestFactory requestFactory, 
            IResponseHandler handler = null) {

            var httpRequestMessage = requestFactory.CreateRequest();
            httpRequestMessage.Properties[PropertyKeyLinkRelation] = requestFactory.LinkRelation;

            return httpClient.SendAsync(httpRequestMessage)
                .ApplyRepresentationToAsync(handler);
        }
开发者ID:hapikit,项目名称:hapikit.net,代码行数:11,代码来源:HttpClientExtensions.cs

示例13: SetUp

 public void SetUp()
 {
     factory = Substitute.For<IRequestFactory>();
     var client = Substitute.For<IRestClient>();
     var request = Substitute.For<IRestRequest>();
     var response = Substitute.For<IRestResponse>();
     factory.CreateClient().Returns(client);
     factory.CreateRequest(null).ReturnsForAnyArgs(request);
     client.Execute(request).Returns(Task.FromResult(response));
     response.StatusCode.Returns(HttpStatusCode.OK);
     descendant = new VkClientDescendant(factory, Substitute.For<IClientConfiguration>());
 }
开发者ID:chesiq,项目名称:restsharp.portable,代码行数:12,代码来源:VkClientTests.cs

示例14: Follow

        //[Fact]
        //public  Task CompareApproaches()
        //{
        //    //// Wrapper Service 
        //    //var customerService = new CustomerService();
        //    //var customer = customerService.GetCustomer(22);
        //    //application.Process(customer);

        //    //// Hypermedia Centric
        //    //var customerLink = linkFactory.Create<CustomerLink>();
        //    //customerLink.Id = 22;
        //    //application.FollowLink(customerLink);



        //}


        private static async Task Follow(IRequestFactory link)
        {
            var request = link.CreateRequest();

            var httpClient = new HttpClient();
            httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("test", "1.0"));

            var response = await httpClient.SendAsync(request);
            var responseHandler = link as IResponseHandler;
            if (responseHandler != null)
            {
                await responseHandler.HandleResponseAsync(link.LinkRelation, response);
            }
        }
开发者ID:tavis-software,项目名称:Tavis.Link,代码行数:32,代码来源:LinkStory.cs

示例15: EntityBase

 protected EntityBase(IRequestFactory requestFactory, IJsonSerializer jsonSerializer, IRestClient restClient)
 {
     if (requestFactory == null)
     {
         throw new ArgumentNullException("requestFactory");
     }
     if (jsonSerializer == null)
     {
         throw new ArgumentNullException("jsonSerializer");
     }
     if (restClient == null)
     {
         throw new ArgumentNullException("restClient");
     }
     _requestFactory = requestFactory;
     _jsonSerializer = jsonSerializer;
     _restClient = restClient;
 }
开发者ID:Hihaj,项目名称:BeaconpushSharp,代码行数:18,代码来源:EntityBase.cs


注:本文中的IRequestFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。