DapperLib/Dapper.Contrib

determine the types of arguments for generic method is incorrect

Gamain opened this issue · 0 comments

I use Dapper.Contrib to insert my Entity, my code like this

cn.Insert(instance);

when the type of entity instance is created by emit , the generic method in Dapper.Contrib.Extensions.SqlMapperExtensions

public static long Insert<T>(this IDbConnection connection, T entityToInsert, IDbTransaction transaction = null, int? commandTimeout = null) where T : class
{
            var isList = false;

            var type = typeof(T);

            if (type.IsArray)
            {
                isList = true;
                type = type.GetElementType();
            }
  // other codes
}

can't determine the types of entityToInsert correct, because var type = typeof(T); return typeof(object)

here is the sourcecode https://github.com/StackExchange/Dapper/blob/master/Dapper.Contrib/SqlMapperExtensions.cs#L332