• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IRequestFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SetUp

        public void SetUp()
        {
            restRequest = Substitute.For<IRestRequest>();
            restResponse = Substitute.For<IRestResponse>();

            restClient = Substitute.For<IRestClient>();
            restClient.Execute(restRequest).Returns(restResponse);

            factory = Substitute.For<IRequestFactory>();
            factory.NewClient().Returns(restClient);
            factory.NewRequest().Returns(restRequest);

            var configuration = Substitute.For<IClientConfiguration>();

            configuration.ClientId.Returns("client_id");
            configuration.ClientSecret.Returns("client_secret");
            configuration.RedirectUri.Returns("http://redirect-uri.net");
            configuration.Scope.Returns("scope");

            descendant = new OAuth2ClientDescendant(factory, configuration);
        }
开发者ID:carepass,项目名称:code-samples,代码行数:21,代码来源:OAuth2ClientTests.cs


示例17: AbstractRequest

        /**
         * Creates new request with parameters. See documentation for methods here https://vk.com/dev/methods
         *
         * @param method     API-method name, e.g. audio.get
         * @param parameters method parameters
         * @param httpMethod HTTP method for execution, e.g. GET, POST
         */
        protected AbstractRequest(string method, VKParameters parameters, HttpMethod httpMethod, IRequestFactory requestFactory)
        {
            methodName = method;
            if (parameters == null)
            {
                parameters = new VKParameters();
            }
            mMethodParameters = new VKParameters(parameters);
            if (httpMethod == null)
                httpMethod = HttpMethod.GET;
            this.httpMethod = httpMethod;
            this._requestFactory = requestFactory;
            mAttemptsUsed = 0;

            secure = true;
            //By default there is 1 attempt for loading.
            attempts = 1;

            //If system language is not supported, we use english
            mPreferredLang = "en";
            //By default we use system language.
            useSystemLanguage = true;
        }
开发者ID:NGWeb,项目名称:VkApi,代码行数:30,代码来源:AbstractRequest.cs


示例18: SetUp

        public void SetUp()
        {
            restRequest = Substitute.For<IRestRequest>();
            restResponse = Substitute.For<IRestResponse>();

            restResponse.StatusCode.Returns(HttpStatusCode.OK);
            restResponse.RawBytes.Returns(_encoding.GetBytes("response"));

            restClient = Substitute.For<IRestClient>();
            restClient.Execute(restRequest).Returns(Task.FromResult(restResponse));

            factory = Substitute.For<IRequestFactory>();
            factory.CreateClient().Returns(restClient);
            factory.CreateRequest(null).ReturnsForAnyArgs(restRequest);

            var configuration = Substitute.For<IClientConfiguration>();

            configuration.ClientId.Returns("client_id");
            configuration.ClientSecret.Returns("client_secret");
            configuration.RedirectUri.Returns("http://redirect-uri.net");
            configuration.Scope.Returns("scope");

            descendant = new OAuth2ClientDescendant(factory, configuration);
        }
开发者ID:chesiq,项目名称:restsharp.portable,代码行数:24,代码来源:OAuth2ClientTests.cs


示例19: OAuth2Client

 /// <summary>
 /// Initializes a new instance of the <see cref="OAuth2Client"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 protected OAuth2Client(IRequestFactory factory, IClientConfiguration configuration)
 {
     ExpirationSafetyMargin = TimeSpan.FromSeconds(5);
     _factory = factory;
     Configuration = configuration;
 }
开发者ID:ReachContact,项目名称:restsharp.portable,代码行数:11,代码来源:OAuth2Client.cs


示例20: AsanaClient

 /// <summary>
 /// Initializes a new instance of the <see cref="AsanaClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public AsanaClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
开发者ID:titarenko,项目名称:OAuth2,代码行数:9,代码来源:AsanaClient.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IRequestHandler类代码示例发布时间:2022-05-24
下一篇:
C# IRequestContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap