There is a SharePoint 2010 Developer Training Course over at the Channel 9 Learning Center. There are a few places where I tweaked things a bit to make it work the way I wanted.
One of the labs is a LINQ to SharePoint lab. It has two parts
By default, the list creation feature has “Web" scope, and the sample code relies on that scope—it casts “properties.Feature.Parent” to an SPWeb object in the FeatureActivated and FeatureDeactivating methods. The Web Part that depends on that feature has “Site” scope, and has to have “Site” scope.
Here’s the original method—note line #3:
Since I wanted to make the dependence explicit, I had to elevate the scope of the first feature to “Site” scope. Of course, that breaks the sample code. I revised the code to acquire the SPSite object and retrieved the web site from that object. Line 3 was replace by lines 3 through 5.
I made same change in the “FeatureActivated” method of the event listener. Now, I can deploy and retract in a single package.