Friday, July 12, 2013

Introducing PetaPoco for Informix

I've created a fork of PetaPoco, with support for Informix and named parameters. I've also added multiple key support.

The code is available on GitHub.

An example:
public class Ship
    public int Id { get; set; }

    public string Name { get; set; }

public class PositionLog
    public int ShipId { get; set; }

    public int EpochDate { get; set; }

    public int Latitude {get;set;}

    public int Longitude {get;set;}

var db = new Database(new IfxConnection("<ConnectionString>");
int shipId = 1234;
var ship = db.Query<Ship>("select first 1 * from ship where shipid = @id", new { id = shipId }).FirstOrDefault();

ship.Name = "Submarine";


The code will be updated with support of more features as we move along with our project (which uses Informix).