Instead of creating a loop to go over the collection to find your entity, you can take advantage of the Predicates.
Model.Person foundPerson =(Model.Person) personCollection.Find(delegate(Model.Person e) { return e.FirstName == "John"; });
I hope this is helpful. I did not find anything in the SubSonic forums regarding the Find method. This worked for me instead of creating a loop to go over all items in the collection.
Thanks for sharing this! Very helpfull.
ReplyDeleteA great example. I'm am running into situation where I need a composite key on a collection (where the primary key is not relevant) I'm having hard time passing two keys without having to create a class (which seems a bit too much work when you can convert it to a table and query the table...hmmmm?
ReplyDelete