-
Notifications
You must be signed in to change notification settings - Fork 588
Description
Exception:
This operation is only valid on generic types.
at System.RuntimeType.GetGenericTypeDefinition()
at DapperExtensions.DapperImplementor.AddParameter[T](T entity, DynamicParameters parameters, IMemberMap prop, Boolean useColumnAlias)
at DapperExtensions.DapperImplementor.GetDynamicParameters[T](T entity, IClassMapper classMap, IList1 sequenceColumn, IList1 foreignKeys, IList1 ignoredColumns, Boolean useColumnAlias) at DapperExtensions.DapperImplementor.GetDynamicParameters[T](IClassMapper classMap, T entity, Boolean useColumnAlias) at DapperExtensions.DapperImplementor.InternalInsert[T](IDbConnection connection, T entity, IDbTransaction transaction, Nullable1 commandTimeout, IClassMapper classMap, IList1 nonIdentityKeyProperties, IMemberMap identityColumn, IMemberMap triggerIdentityColumn, IList1 sequenceIdentityColumn)
at DapperExtensions.DapperAsyncImplementor.InternalInsertAsync[T](IDbConnection connection, T entity, IDbTransaction transaction, Nullable1 commandTimeout, IClassMapper classMap, IList1 nonIdentityKeyProperties, IMemberMap identityColumn, IMemberMap triggerIdentityColumn, IList1 sequenceIdentityColumn) at DapperExtensions.DapperAsyncImplementor.InsertAsync[T](IDbConnection connection, T entity, IDbTransaction transaction, Nullable1 commandTimeout)
In DapperImplementor:
if (prop.MemberInfo.DeclaringType == typeof(bool) || (prop.MemberInfo.DeclaringType.IsGenericType && prop.MemberType.GetGenericTypeDefinition() == typeof(Nullable<>) && prop.MemberInfo.DeclaringType.GetGenericArguments()[0] == typeof(bool)))
{
...
}
There should be a check prop.MemberType.IsGenericType before prop.MemberType.GetGenericTypeDefinition()