http://code.google.com/p/dapper-dot-net/source/browse/PerformanceTests.cs
Confused, PerformanceTest.Run initializes the list by adding test objects.
How does it actually run the query?
I’m guessing it is the line:
for (int i = 1; i <= iterations; i++)
{
foreach (var test in this.OrderBy(ignore => rand.Next()))
{
test.Watch.Start();
test.Iteration(i);
test.Watch.Stop();
}
}
test.iteration(i);
But how? Is this a delegate?
Yes,
Actiontype is the key here.Action<T>is a built-in delegate type that has no return value and (in this case) takes one parameter of typeT.Iterationis the property of typeAction<int>where the test action is stored inTestobject, and()operator just invokes the method withiparameter.