Hi, I'm right now verifying RepoDb for my project, but I found a problem that I'm not able to fix on my own. I have this entity I'm trying to insert into my sqlite database but receiving following exception.
No coercion operator is defined between types 'System.String' and 'System.Guid'.
at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
at System.Linq.Expressions.Expression.Convert(Expression expression, Type type, MethodInfo method)
at RepoDb.Reflection.FunctionFactory.<>c__DisplayClass6_0`1.<GetDataEntityDbCommandParameterSetterFunction>b__0(Expression instance, ParameterExpression property, DbField dbField, ClassProperty classProperty, Boolean skipValueAssignment, ParameterDirection direction)
at RepoDb.Reflection.FunctionFactory.GetDataEntityDbCommandParameterSetterFunction[TEntity](IEnumerable`1 inputFields, IEnumerable`1 outputFields, IDbSetting dbSetting)
at RepoDb.FunctionCache.GetDataEntityDbCommandParameterSetterFunctionCache`1.Get(String cacheKey, IEnumerable`1 inputFields, IEnumerable`1 outputFields, IDbSetting dbSetting)
at RepoDb.DbConnectionExtension.<>c__DisplayClass242_0`2.<InsertInternalBase>b__0()
at RepoDb.Contexts.Execution.InsertExecutionContextCache`1.Get(String tableName, IEnumerable`1 fields, Func`1 callback)
at RepoDb.DbConnectionExtension.InsertInternalBase[TEntity,TResult](IDbConnection connection, String tableName, TEntity entity, IEnumerable`1 fields, String hints, Nullable`1 commandTimeout, IDbTransaction transaction, ITrace trace, IStatementBuilder statementBuilder, Boolean skipIdentityCheck)
at RepoDb.DbConnectionExtension.InsertInternal[TEntity,TResult](IDbConnection connection, TEntity entity, String hints, Nullable`1 commandTimeout, IDbTransaction transaction, ITrace trace, IStatementBuilder statementBuilder)
at roda.framework.entity.Upsert.UpsertRepository`1.<>c__DisplayClass6_0.<InsertEntity>b__0(IDbConnection db)
db.ExecuteNonQuery(@"CREATE TABLE IF NOT EXISTS DemoUpsertObj
(
Id TEXT PRIMARY KEY,
EntityId INTEGER,
Name TEXT NOT NULL,
ValidFrom Datetime,
ValidTo datetime,
Deleted byte
);
");
public class DemoUpsertObj : IUpsertEntity
{
// [PropertyHandler(typeof(GuidToStringPropertyHandler))]
public Guid Id { get; set; }
public long EntityId { get; set; }
public DateTime ValidFrom { get; set; }
public DateTime ValidTo { get; set; }
public byte Deleted { get; set; }
public string Name { get; set; }
public DemoUpsertObj() { }
public DemoUpsertObj(string name)
{
Name = name;
}
}
Hi, I'm right now verifying RepoDb for my project, but I found a problem that I'm not able to fix on my own. I have this entity I'm trying to insert into my sqlite database but receiving following exception.
I also tried it with a
PropertyHandlerandPropertyHandlerMapper.Add(typeof(Guid), new GuidToStringPropertyHandler());but the functions in GuidToStringPropertyHandler were never called. I'm running it on MacOS 10.13.6 in a dotnet core 2.0 project .