Dave Burke : Freelance .NET Web Developer specializing in Online Communities

CS CodeSmith Snippet of the Day

I know I should be able to crank out an instance of a custom Community Server Data Provider in my sleep, but I'm a wuss and find it tedious, even though we're only talking about two lines of code.  I seem to have to type those two lines pretty frequently, too, so today I created a quick CodeSmith ActiveSnippet to do it for me.

DBVTDataProvider dp = DBVTDataProvider.Instance();
userPurchases = dp.GetUserPurchases(userID);


With my CodeSmith ActiveSnippet I type


dp userPurchases


then Ctrl-E, Ctrl-E and I have my instance code written up to the GetUserPurchases(userID) part.  A cool minor functional point about this snippet is that the cursor is at the end of "dp" when the snippet creates the code, so typing "." with no additional cursor movement displays Intellisense right away.

 

 

The CodeSmith template has nothing interesting going on other than the logic to optionally return an object for those times I need to use an ExecuteNonQuery command.

 

Comments (0) | Post RSS RSS comment feed

Posted on 8/21/2007 5:16:19 PM by Dave Burke
Categories: .NET | CodeSmith | Community Server
Tags:

Related posts


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke