Skip to content

Instantly share code, notes, and snippets.

@aboutdev
aboutdev / gist:4945917
Created February 13, 2013 16:38
Dapper change to validate mapping. DRAGONS!!!
public static Func<IDataReader, object> GetTypeDeserializer(
#if CSHARP30
Type type, IDataReader reader, int startBound, int length, bool returnNullIfFirstMissing
#else
Type type, IDataReader reader, int startBound = 0, int length = -1, bool returnNullIfFirstMissing = false, bool validateAllFieldsHaveData = false
#endif
)
{
var dm = new DynamicMethod(string.Format("Deserialize{0}", Guid.NewGuid()), typeof(object), new[] { typeof(IDataReader) }, true);