示例#1
0
        public void SetRequestBuilder(Type linkType, DelegatingRequestBuilder builder)
        {
            var t   = (ILink)Activator.CreateInstance(linkType);
            var reg = _LinkRegistry[t.Relation];

            reg.RequestBuilder = builder;
        }
示例#2
0
 public void AddRequestBuilder(DelegatingRequestBuilder requestBuilder)
 {
     if (_httpRequestBuilder != null)
     {
         _httpRequestBuilder.NextBuilder = requestBuilder;
     }
     else
     {
         _httpRequestBuilder = requestBuilder;
     }
 }
示例#3
0
        public void SetRequestBuilder <T>(IEnumerable <DelegatingRequestBuilder> builders) where T : ILink, new()
        {
            var t   = new T();
            var reg = _LinkRegistry[t.Relation];

            DelegatingRequestBuilder currentBuilder = null;

            foreach (var requestBuilder in builders.Reverse())
            {
                requestBuilder.NextBuilder = currentBuilder;
                currentBuilder             = requestBuilder;
            }
            reg.RequestBuilder = currentBuilder;
        }
示例#4
0
 public void SetRequestBuilder <T>(DelegatingRequestBuilder builder) where T : ILink, new()
 {
     SetRequestBuilder <T>(new [] { builder });
 }
示例#5
0
 public Link()
 {
     Method              = HttpMethod.Get;
     Relation            = LinkHelper.GetLinkRelationTypeName(GetType());
     _httpRequestBuilder = new DefaultRequestBuilder();
 }