private void button14_Click(object sender, EventArgs e) { string testType = "Stored Procedure via Entity Client"; _watch.Start(testType); for (int i = 0; i < 50; i++) { using (EntityConnection conn = new EntityConnection(ConfigurationManager.ConnectionStrings["OrderITEntities"].ConnectionString)) { conn.Open(); using (EntityCommand comm = new EntityCommand("OrderITEntities.GetCustomersForTest", conn)) { comm.CommandType = CommandType.StoredProcedure; comm.Parameters.AddWithValue("name", "C%"); using (EntityDataReader reader = comm.ExecuteReader(CommandBehavior.SequentialAccess)) { while (reader.Read()) { var x = reader.GetValue(0); var x1 = reader.GetValue(1); var x2 = reader.GetValue(2); var x3 = reader.GetValue(3); var x4 = reader.GetValue(4); } } } } _watch.SaveLap(); } _watch.Stop(); }
private void button9_Click(object sender, EventArgs e) { string testType = "Select Customers With EF and EntitySQL via Entity Client. Plan Cache Enabled: " + UseCompiledQuery.Checked; _watch.Start(testType); for (int i = 0; i < 50; i++) { using (EntityConnection conn = new EntityConnection(ConfigurationManager.ConnectionStrings["OrderITEntities"].ConnectionString)) { conn.Open(); using (EntityCommand comm = new EntityCommand("SELECT VALUE c FROM OFTYPE(OrderITEntities.Companies, OrderITModel.Customer) AS c WHERE c.name LIKE @name", conn)) { comm.EnablePlanCaching = enablePlanCaching.Checked; comm.Parameters.AddWithValue("name", "C%"); using (EntityDataReader reader = comm.ExecuteReader(CommandBehavior.SequentialAccess)) { while (reader.Read()) { var x = reader.GetValue(0); var x1 = reader.GetValue(1); var x2 = reader.GetValue(2); var x3 = reader.GetValue(3); var x4 = reader.GetValue(4); } } } } _watch.SaveLap(); } _watch.Stop(); }
// Verifies that all values contained in the reader satisfy the given condition private static void VerifyValueCondition(EntityDataReader reader, Func <object, bool> condition) { while (reader.Read()) { var value = reader.GetValue(0); Assert.True(condition(value)); } }
private static void VerifyAgainstBaselineResults(EntityDataReader reader, IEnumerable <object> expectedResults) { var actualResults = new List <object>(); while (reader.Read()) { actualResults.Add(reader.GetValue(0)); } Assert.True(expectedResults.SequenceEqual(actualResults)); }