Created
June 26, 2012 10:51
-
-
Save cburgdorf/2995071 to your computer and use it in GitHub Desktop.
Totally abusing LINQPad and the Entity Framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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