Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: ulid type converter error in 1.13.0 after #1172

Open
IfunJoework opened this issue Apr 12, 2024 · 0 comments
Open

Bug: ulid type converter error in 1.13.0 after #1172

IfunJoework opened this issue Apr 12, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@IfunJoework
Copy link

Bug Description

Referring to the previous isusses to create PropertyHandler, an error occurred during test execution. After lowering the version, it can be executed normally.

Exception Message:

ArgumentException: Expression of type 'System.String' cannot be used for parameter of type 'System.Ulid' of method 'Void set_Id(System.Ulid)' (Parameter 'arg0')
System.Dynamic.Utils.ExpressionUtils.ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arguments, ParameterInfo pi, string methodParamName, string argumentParamName, int index)
System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, Expression arg0)
System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, IEnumerable<Expression> arguments)
RepoDb.Reflection.Compiler.CompileDataEntityPropertySetter(Type entityType, PropertyInfo property, Type targetType)
RepoDb.Reflection.Compiler.CompileDataEntityPropertySetter(Type entityType, Field field)
RepoDb.Reflection.FunctionFactory.CompileDataEntityPropertySetter(Type entityType, Field field)
RepoDb.FunctionCache+DataEntityPropertySetterCache.Get(Type type, Field field)
RepoDb.FunctionCache.GetDataEntityPropertySetterCompiledFunction(Type entityType, Field field)
RepoDb.Contexts.Providers.InsertExecutionContextProvider.CreateInternal(Type entityType, IDbConnection connection, IEnumerable<DbField> dbFields, string tableName, IEnumerable<Field> fields, string commandText)
RepoDb.Contexts.Providers.InsertExecutionContextProvider.Create(Type entityType, IDbConnection connection, string tableName, IEnumerable<Field> fields, string hints, IDbTransaction transaction, IStatementBuilder statementBuilder)
RepoDb.DbConnectionExtension.InsertInternalBase<TEntity, TResult>(IDbConnection connection, string tableName, TEntity entity, IEnumerable<Field> fields, string hints, Nullable<int> commandTimeout, string traceKey, IDbTransaction transaction, ITrace trace, IStatementBuilder statementBuilder)
RepoDb.DbConnectionExtension.InsertInternal<TEntity, TResult>(IDbConnection connection, string tableName, TEntity entity, IEnumerable<Field> fields, string hints, Nullable<int> commandTimeout, string traceKey, IDbTransaction transaction, ITrace trace, IStatementBuilder statementBuilder)
RepoDb.DbConnectionExtension.Insert<TEntity>(IDbConnection connection, TEntity entity, IEnumerable<Field> fields, string hints, Nullable<int> commandTimeout, string traceKey, IDbTransaction transaction, ITrace trace, IStatementBuilder statementBuilder)

PropertyHandler:

public class UlidPropertyHandler : IPropertyHandler<string, Ulid>
{
    public Ulid Get(string input, ClassProperty options)
    {
        return Ulid.Parse(input);
    }

    public string Set(Ulid input, ClassProperty options)
    {
        return input.ToString();
    }
}

The same code will work fine with RepoDb 1.12.10 / 1RepoDb.SqlServer .1.5

Library Version:

RepoDb v1.13.1 and RepoDb.SqlServer v1.13.1

@IfunJoework IfunJoework added the bug Something isn't working label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants