Skip to content

Instantly share code, notes, and snippets.

@cburgdorf
Created June 26, 2012 10:51
Show Gist options
  • Save cburgdorf/2995071 to your computer and use it in GitHub Desktop.
Save cburgdorf/2995071 to your computer and use it in GitHub Desktop.
Totally abusing LINQPad and the Entity Framework
// Totally abusing LINQPad and the Entity Framework
void Main()
{
var connection = (System.Data.EntityClient.EntityConnection)this.Connection;
var con = connection.StoreConnection;
var initState = con.State;
try
{
if (initState != ConnectionState.Open)
con.Open();
using (var cmd = con.CreateCommand())
{
cmd.CommandText = "SELECT * FROM \"t_Tour\" WHERE \"t_Tour\".\"tou_TVSID\" = 58749";
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
var values = new object[reader.FieldCount];
reader.GetValues(values);
values.Dump();
}
}
}
}
finally
{
if (initState != ConnectionState.Open)
con.Close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment