Getting to know NPoco

Everyone loves a great library. One that shows up for work, does it’s job, and goes home without any hastle. They’re the tools that sit on our shelf, ready for use on just about any task. PetaPoco happens to be one of them.

But all tools get worn down over time and PetaPoco is no exception. It’s been almost 2 years since an update was made to the PetaPoco code base.

So whats NPoco?

NPoco picks up where PetaPoco leaves off. Take a look at the list of features and you’ll notice a lot of un-supported features in PetaPoco, now standard in NPoco.

An IDatabase abstration for unit testing

using (IDatabase db = new Database("connStringName")) 

Change Tracking

var snapshot = db.StartSnapshot(user); 
db.Update(user, snapshot.UpdatedColumns());

Composit Key Support

public class User

An improved interface for building SQL

    .Where("height >= @0", 176)
    .Where("weight > @0 and weight < @1", 30, 60);

var db = new Database("conn");

But heres the kicker...

Because NPoco is built on PetaPoco, you get all the same standard features as PetaPoco with the addition of many other features such as the ones above. So, if you’re using PetaPoco today, you may want to think about upgrading.