Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using System;
using SqlKata;
using SqlKata.Execution;
using SqlKata.Compilers;
using System.Data.SqlClient;
namespace CData.SqlKata.CDataSampleProject
class Program
static void Main(string[] args)
Console.WriteLine("Hello World!");
var connection = new SqlConnection("Data Source=localhost;Initial Catalog=AdventureWorks2014;Integrated Security=True");
var compiler = new SqlServerCompiler();
var db = new QueryFactory(connection, compiler);
var persons = db.Query("Person.Person").Limit(10).Get<Person>();
foreach (var item in persons)
Console.WriteLine($"BusinessEntityID: {item.BusinessEntityID}; FirstName: {item.FirstName}; LastName: {item.LastName};");
public class Person
public string BusinessEntityID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment