From b8dedd0eeec5d901ff233000dff205e96369571b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 May 2012 13:50:24 +0100 Subject: [PATCH] Added a test to compare performance to DataTable (via IDataReader.GetValues) --- Tests/PerformanceTests.cs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Tests/PerformanceTests.cs b/Tests/PerformanceTests.cs index 3f5e451d7..463eafa96 100644 --- a/Tests/PerformanceTests.cs +++ b/Tests/PerformanceTests.cs @@ -235,8 +235,37 @@ public void Run(int iterations) } }, "hand coded"); - tests.Run(iterations); + DataTable table = new DataTable + { + Columns = + { + {"Id", typeof (int)}, + {"Text", typeof (string)}, + {"CreationDate", typeof (DateTime)}, + {"LastChangeDate", typeof (DateTime)}, + {"Counter1", typeof (int)}, + {"Counter2", typeof (int)}, + {"Counter3", typeof (int)}, + {"Counter4", typeof (int)}, + {"Counter5", typeof (int)}, + {"Counter6", typeof (int)}, + {"Counter7", typeof (int)}, + {"Counter8", typeof (int)}, + {"Counter9", typeof (int)}, + } + }; + tests.Add(id => { + idParam.Value = id; + object[] values = new object[13]; + using(var reader = postCommand.ExecuteReader()) + { + reader.Read(); + reader.GetValues(values); + table.Rows.Add(values); + } + }, "DataTable via IDataReader.GetValues"); + tests.Run(iterations); } }