Closed GoogleCodeExporter closed 9 years ago
Aaaaand I skipped from 4 to 6 in my steps to reproduce. <sigh> Been a long day.
Original comment by grkaiser@gmail.com
on 30 Aug 2010 at 11:47
Hey grkaiser,
From my understanding, the entries property of the Feed class is not designed
to be iterated over more than once. You should be able to use
_contactsFeed.Entries.ToList to save the list of contacts to a List(Of
Contacts). You can then use the List to iterate over your contacts more than
once. You can also use the List's Find method to find what your're looking
for. I'm not so quick with the c# (don't like the semicolons), but below is a
quick and dirty example in VB:
Public Class MyClass
Private _UriToFind As String
Public Sub GetContacts()
''''
''''
'Get Feed
''''
''''
Dim feed As Google.GData.Client.Feed(Of Google.Contacts.Contact)
Dim listOfContacts As List(Of Google.Contacts.Contact) = feed.Entries.ToList
Dim foundContact As Google.Contacts.Contact
_UriToFind = "Your Uri"
foundContact = listOfContacts.Find(AddressOf FindContactWithUri)
End Sub
Private Function FindContactWithUri(ByVal contact As Google.Contacts.Contact) As Boolean
Dim result As Boolean = False
If contact.ContactEntry.Id.AbsoluteUri = _UriToFind Then
result = True
End If
Return result
End Function
End Class
Original comment by edwin.la...@gmail.com
on 31 Aug 2010 at 3:42
[deleted comment]
@edwin.landy: That's true, I can use the Entries collection to create my own
collection and then everything seems to play nicely.
It turns out that if I take a look at Feed<T>'s Entries property the summary in
trunk/clients/cs/src/core/feedmodel.cs states:
"Note that you should cache the entries returned in a list of your own if you
want to access them more than once, as this one does no caching on it's own."
Three things about that though.
#1 that summary is commented out, so it'll never show up anywhere and be
helpful. i.e. It won't show up in the pop-up's in VS.
#2 the documentation on the library makes absolutely no mention of caching the
results.
#3 I don't believe that that's the standard or correct behavior for an
IEnumerable<T> collection. I understand, though, that since the property is
dealing with issues with auto-paging and getting results from the server that
it might work differently than usual collections.
I still think that this is something that deserves a big exclamation mark next
to it to ensure that the consuming code does cache the results, because the
behavior is as confusing as all get-out.
Original comment by grkaiser@gmail.com
on 1 Sep 2010 at 9:55
There are a lot of places in the code where the comments of the base class
don't show through to the classes that actually get used. Maybe that's
something that we in the community can work on? Can a committer let us know
the best way we can get this done?
Maybe Frank can chime in on why there's no caching. It's probably got
something to do with the way the feed class automatically pages through the
'next' batch of 100 results.
Original comment by edwin.la...@gmail.com
on 2 Sep 2010 at 12:20
That's pretty much it. Considering that results are not guaranteed to be
identical between queries in google services (heck, the whole world can add
videos to youtube, e.g.) coming up with a simple caching scheme is pretty much
impossible, so i left that to the application developer, as the app developer
is the best one to judge what to cache, and what not.
That the long, and hopefully helpful comment is not showing up is a bug/problem
with the documentation system. I need to change that to follow the stupid ///
convention. You would hope that longer comments like this would still be parsed
correctly, but, nope....
Original comment by frank%ma...@gtempaccount.com
on 7 Sep 2010 at 10:58
Original comment by ccherub...@google.com
on 29 Jul 2011 at 10:08
Original issue reported on code.google.com by
grkaiser@gmail.com
on 30 Aug 2010 at 11:38