2013-07-24 3 views
1

최신 버전의 LINQ to Twitter v2.1.08에서는 더 이상 페이징을 지원하지 않습니다. 페이지 속성이없는 특정 페이지를 얻으려면 어떻게해야합니까?상태에서 페이징 속성이 누락되었습니다.

건배

int curPageIndex=5; 
string pageindex="5"; 
string cmd = "next"; 
using (var twitterCtx = new TwitterContext(myauth)) 
    { 
    try 
    { 
     // set up the "main query" 
     IQueryable<Status> test = from tweet in twitterCtx.Status select tweet; 


     switch (cmd) 
     { 
     case "prev": 

      test = pageindex.Length > 0 
        ? test.Where(p => p.Type == StatusType.Home && p.Page == curPageIndex)      
        : test.Where(p => p.Type == StatusType.Home); 
      break; 
     case "next": 
      test = pageindex.Length > 0 
        ? test.Where(p => p.Type == StatusType.Home && p.Page == curPageIndex)      
        : test.Where(p => p.Type == StatusType.Home); 
      break; 
     default:    
      // 
      test = test.Where(p => p.Type == StatusType.Home); 
      break; 
     }   

솔루션

답변

1

:

//Get the statusids in the query, add or subtract so you skip current id's 
ulMaxId = test.Min(status => ulong.Parse(status.StatusID)) - 1; 
ulSinceID = test.Max(status => ulong.Parse(status.StatusID)) + 1; 

//Return ID above and use them in future calls (below) 

//Now you can navigate timelines, depending if you are stepping forward or backwards 

? test.Where(p => p.Type == StatusType.Home && p.SinceID == ulong.Parse(sinceid) 
... 
? test.Where(p => p.Type == StatusType.Home && p.MaxID == ulong.Parse(maxid)) 
+1

트위터 API 버전 1.1이 since_id 및 max_id 찬성, 페이지 매개 변수를 제거 변경 페이지 매개 변수 SinceID 및 MaxID에. 당신은 이것을 보았을 지 모르지만 다른 누구도 같은 문제가있는 경우를 대비하여 게시 할 것입니다 - Twitter에서 LINQ로 타임 라인 작업하기 : http://geekswithblogs.net/WinAZ/archive/2012/09/02/working-with -timelines-with-linq-to-twitter.aspx –

관련 문제