Skip to content

Instantly share code, notes, and snippets.

@bhameyie
Created May 28, 2013 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhameyie/5666861 to your computer and use it in GitHub Desktop.
Save bhameyie/5666861 to your computer and use it in GitHub Desktop.
query data with dynamic
class Person
{
public int Id { get; set; }
public int Age { get; set; }
public string Name { get; set; }
public Person()
{
}
}
[TestFixture]
public class FunTest{
[Test]
public void Retrieval_example(){
var sqlBuilder = Database.Open().Persons.FindAllByName("li'l piggy");
Assert.AreEqual("Select * from Persons Where Name = 'li''l piggy'", sqlBuilder.ToString());
dynamic dynTable = new DynamicTable(dataTable);
var persons = new List<Person>();
for (int i = 0; i < dynTable.Count; i++)
{
persons.Add(dynTable[i].Convert<Person>());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment