Skip to content

Commit

Permalink
Merge pull request #79 from abe545/improve-hierarchical-speed
Browse files Browse the repository at this point in the history
Improve hierarchical speed
  • Loading branch information
abe545 authored Aug 2, 2016
2 parents 3b22f86 + 07beb94 commit 1661a00
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 131 deletions.
10 changes: 9 additions & 1 deletion CodeOnlyStoredProcedure/PropertyInfoExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;

namespace CodeOnlyStoredProcedure
Expand Down Expand Up @@ -29,5 +31,11 @@ public static string GetSqlColumnName(this PropertyInfo pi)

return pi.Name;
}

public static Func<TItem, TProp> CompileGetter<TItem, TProp>(this PropertyInfo prop)
{
var i = Expression.Parameter(typeof(TItem), "i");
return Expression.Lambda<Func<TItem, TProp>>(Expression.Property(i, prop), i).Compile();
}
}
}
Loading

0 comments on commit 1661a00

Please sign in to comment.