Friday, June 28, 2013

Getting Started With Dapper Part 2

This video is part 2 of a very basic introduction to the micro ORM Dapper for use with the .Net platform.  I go over IEnumerable and how it relates to Dapper, as well as demonstrating several different classes that implement IEnumerable (Lists, Arrays, Dictionaries).

I also go over what happens with .First and .FirstOrDefault when used with Dapper/IEnumerable and how the behavior can be different for value types vs. reference types.




The source code for this project can be found here: 

You can find more info about Dapper here: code.google.com/p/dapper-dot-net/.

Tuesday, June 25, 2013

An apology to Jon Skeet

Mr. Skeet doesn't know me and no one that knows me has ever heard me say anything negative about him, so it may seem odd that I'm writing this apology.

But sometimes, when no one is around, and I'm watching a video from tekpub (like one of these), I find myself drumming my fingers and eventually I yell something like this:

"GET TO THE POINT!  I don't care about every last little nuance of the CLR!  Who cares if Ildasm looks different for this or that, just tell me about Lambdas!  Great Caesar's Ghost!  Just stop it already, quit bringing up Noda-Time and get to point!".

Well, I'm trying to make some screen casts of my own and in addition to trying to get the sound to...sound right, I'm realizing that many times you have to go deep into the details or you aren't explaining things properly.

Take my first stab, Getting Started With Dapper.  Dapper has been out for a while (most howto posts regarding Dapper are from 2011) so I thought it would be fairly easy to do a screen cast on it.  I've used it a lot.  I know my way around it.  Piece of cake, right?

Everything was going fine until I realized that I didn't really explain why I put a ToList() on the end of my Dapper.Query<T> calls.  The reason, of course, is that I like working with generic lists and .Query<T> returns IEnumerable<T>.  So I throw on a .ToList() to get things like I want them.  But that brings up the question, why does Dapper do that?  If I don't explain why IEnumerable is used instead of other collection types, then I'm really doing a screen cast on how I use Dapper rather than what Dapper does.

So I started writing text for an aside on IEnumerable.  I quickly realized this needed to be it's own separate screen cast because when you hit the period after typing .Query<T>("") there are a kah-jillion other Linq extension methods that pop up:

I didn't go crazy and spend time on each one, but there are several that need to be discussed.  And they behave differently with value types vs. references types and reference types behave differently than nullable reference types and...sheesh. I just wanted to make a screen cast about Dapper and expand the brand a little bit and now I'm looking through the C# specifications!

I'm taking my time and hopefully making good choices about what needs to be discussed and what can be left out.  But, there's more to it than I originally thought.

And while I can't claim to have walked a mile in Jon Skeet's shoes (his SO score is 576,875 while mine is...6), I can say that I've walked, maybe an metaphorical inch in his shoes.  After travelling even such a short distance as this, I feel compelled to say to Mr. Skeet, "I'm sorry I yelled at your tekpub video late at night when no one could hear me.  I just didn't know."

Just before I scheduled this post, I went to Mr. Skeet's twitter page and saw this exchange:

Pretty good advice.

Friday, June 21, 2013

My First Screen Cast - Getting Started with Dapper Pt1.

So I decided to try my hand at screen casting.  This is my first effort and I found, as many others have before me, it's not easy getting a screen cast to look anything close to decent. But practice makes...something less bad than before.  Anyway, enough with the self depreciation.

This screen cast is a very basic introduction to the Mirco ORM Dapper.  This and the next several screen casts will be targeted towards what I refer to as "default developers".  Default developers are developers (like myself a few years ago) who primarily take what Microsoft gives them.  If it's not "in the box" or on MSDN, then it's not on the radar.  It is not my intention to demean the default developer.  Like I said, I used to be one.  My intention is to make the material covered as approachable as possible crack open the door to all the great non-Microsoft things that are being done with .Net.

So check out my Dapper video.  If you have any suggestions for improvements or think I got something flat out wrong, please let me know in the comments or send an email.



Intro To Dapper - Part 1 from Jon Wear on Vimeo.

Source code can be found here: https://github.com/genghisjahn/DapperIntroPt1/archive/Pt1.zip