예제 #1
0
 public DataSourceCollectionRoute(DataSourceRootRoute parent, ResourceType resultItemType)
     : base(0, parent)
 {
     if (resultItemType == null)
         throw new ArgumentNullException(nameof(resultItemType));
     this.parent = parent;
     this.resultItemType = resultItemType;
     ResultType = parent.TypeMapper.FromType(typeof(IEnumerable<>).MakeGenericType(resultItemType));
 }
예제 #2
0
 public DataSourceCollectionRoute(DataSourceRootRoute parent, ResourceType resultItemType)
     : base(0, parent)
 {
     if (resultItemType == null)
     {
         throw new ArgumentNullException(nameof(resultItemType));
     }
     this.parent         = parent;
     this.resultItemType = resultItemType;
     ResultType          = parent.TypeMapper.FromType(typeof(IEnumerable <>).MakeGenericType(resultItemType));
 }
예제 #3
0
 private Func <PomonaContext, PomonaResponse> ResolveGetRootResource(DataSourceRootRoute route)
 {
     return(pr =>
     {
         var request = pr;
         var uriResolver = request.Session.GetInstance <IUriResolver>();
         var dictionary = route.Children.OfType <ILiteralRoute>()
                          .ToDictionary(x => x.MatchValue, x => uriResolver.RelativeToAbsoluteUri(x.MatchValue));
         var repos = new SortedDictionary <string, string>(dictionary);
         var resultType = request.TypeMapper.FromType <IDictionary <string, string> >();
         return new PomonaResponse(repos, resultType: resultType);
     });
 }
 private Func<PomonaContext, PomonaResponse> ResolveGetRootResource(DataSourceRootRoute route)
 {
     return pr =>
     {
         var request = pr;
         var uriResolver = request.Session.GetInstance<IUriResolver>();
         var dictionary = route.Children.OfType<ILiteralRoute>()
                               .ToDictionary(x => x.MatchValue, x => uriResolver.RelativeToAbsoluteUri(x.MatchValue));
         var repos = new SortedDictionary<string, string>(dictionary);
         var resultType = request.TypeMapper.FromType<IDictionary<string, string>>();
         return new PomonaResponse(repos, resultType : resultType);
     };
 }