Commit bc5bcf50 authored by Sam Saffron's avatar Sam Saffron

Added Rob's massive ORM

parent c3b7b399
This diff is collapsed.
......@@ -6,6 +6,7 @@
using SqlMapper.Linq2Sql;
using System.Data.Linq;
using System.Diagnostics;
using Massive;
namespace SqlMapper
{
......@@ -89,6 +90,14 @@ public void Run(int iterations)
var mapperConnection = Program.GetOpenConnection();
tests.Add(id => mapperConnection.ExecuteMapperQuery<Post>("select * from Posts where Id = @Id", new { Id = id }).ToList(), "Mapper Query");
var mapperConnection2 = Program.GetOpenConnection();
tests.Add(id => mapperConnection2.ExecuteMapperQuery("select * from Posts where Id = @Id", new { Id = id }).ToList(), "Dynamic Mapper Query");
var massiveConnection = new DynamicModel(Program.connectionString);
tests.Add(id => massiveConnection.Query("select * from Posts where Id = @0", id).ToList(), "Dynamic Massive ORM Query");
// HAND CODED
var connection = Program.GetOpenConnection();
......
......@@ -32,10 +32,11 @@ class Post
class Program
{
public static readonly string connectionString = "Data Source=.;Initial Catalog=tempdb;Integrated Security=True";
public static SqlConnection GetOpenConnection()
{
var connection = new SqlConnection("Data Source=.;Initial Catalog=tempdb;Integrated Security=True");
var connection = new SqlConnection(connectionString);
connection.Open();
return connection;
}
......
......@@ -163,7 +163,7 @@ private static object GetDynamicDeserializer(SqlDataReader reader)
int i = 0;
foreach (var colName in colNames)
{
var tmp = reader.GetValue(i);
var tmp = r.GetValue(i);
row[colName] = tmp == DBNull.Value ? null : tmp;
i++;
}
......
......@@ -59,6 +59,7 @@
<DependentUpon>DataClasses.dbml</DependentUpon>
</Compile>
<Compile Include="Linq2Sql\Post.cs" />
<Compile Include="Massive\Massive.cs" />
<Compile Include="PerformanceTests.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment