I Can't Believe That Worked!

Code and Ideas, minus the profanity (the one language all developers know)

Browse by Tags

All Tags » Linq (RSS)
MetaTable Expression Builder for Fetching Any Object Via Collection of Primary Keys

Basically, I wanted to build a method that gets an object from a data context whatever the primary key may look like, and whatever type that object may be.  I wrote this code a little while ago when I was exploring the DynamicData libs.  I was checking out some of the code in the libs, and noticed a very slick way one of devs was building expressions to grab back a data item based on a single key ID.  I thought the idea of building up the expression completely ROCKED, but I wanted to expand it out to include composite primary keys.  Below is my implementation of the composite primary key object fetcher.  Hopefully, it will make your life a little easier.

...