Unable to mapped underscore column in dapper extension

Viewed 22

I have a user data model containing some underscore columns but I'm unable to insert, update and get records using the dapper extension library it is throwing a reflection error below you can see:

at DapperExtensions.ReflectionHelper.GetParameter(Type entityType, ISqlGenerator sqlGenerator, String propertyName, Object value)
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.InternalUpdate[T](IDbConnection connection, T entity, IClassMapper classMap, IPredicate predicate, IDbTransaction transaction, IList1 cols, Nullable1 commandTimeout, Boolean ignoreAllKeyProperties) at DapperExtensions.DapperAsyncImplementor.<InternalUpdateAsync>d__151.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at DapperExtensions.DapperAsyncImplementor.d__161.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at DapperExtensions.DapperAsyncImplementor.<UpdateAsync>d__31.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at DapperExtensions.AsyncDatabase.d__81.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()

User Data Model:

public class Permission
{
public Guid Id { get; set; }
public string permission_code { get; set; }
public string role_code { get; set; }
public bool HasPermission { get; set; }
public string PermissionStatus { get; set; }
public string addl_data { get; set; }
}

await db.Update(roleView, null, true);

Also, I set this property before and after the connection opened but this is not working throwing the above exception:

IDbConnection con = CreateConnection();
if (con == null)
throw new ApplicationException("CreateConnection function did not return a valid connection");
DefaultTypeMap.MatchNamesWithUnderscores = true;
con.Open();
0 Answers
Related