Skip to content

Instantly share code, notes, and snippets.

@mgroves
Created July 21, 2014 17:53
Show Gist options
  • Select an option

  • Save mgroves/f49ce10d1f115c7308a9 to your computer and use it in GitHub Desktop.

Select an option

Save mgroves/f49ce10d1f115c7308a9 to your computer and use it in GitHub Desktop.
using System.Data;
using System.Linq;
using Dapper;
using Ledger.Models.Entities;
namespace Ledger.Models.CommandQuery.Ledgers
{
public class GetLedgerByIdQuery : IQuery<LedgerEntity>
{
long id;
public GetLedgerByIdQuery(long id)
{
this.id = id;
}
public LedgerEntity Execute(IDbConnection db)
{
return db.Query<LedgerEntity>("SELECT ledger, ledgerdesc, isactive FROM ledgers WHERE ledger = @id", new { id }).FirstOrDefault();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment