Apparently inserting using InsertAll throws up an error about the nullable type.
Unhandled exception. System.ArgumentException: Expression of type 'System.Nullable`1[System.Int64]' cannot be used for parameter of type 'System.Object' of method 'Int64 ToInt64(System.Object)' (Parameter 'arg0')
at System.Dynamic.Utils.ExpressionUtils.ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arguments, ParameterInfo pi, String methodParamName, String argumentParamName, Int32 index)
at System.Linq.Expressions.Expression.Call(MethodInfo method, Expression arg0)
at RepoDb.Reflection.Compiler.ConvertExpressionToSystemConvertExpression(Expression expression, Type toType)
at RepoDb.Reflection.Compiler.ConvertExpressionWithAutomaticConversion(Expression expression, Type fromType, Type toType)
at RepoDb.Reflection.Compiler.GetPropertyValueWithAutomaticConversionExpression(Expression entityExpression, ClassProperty classProperty, DbField dbField)
at RepoDb.Reflection.Compiler.GetEntityInstancePropertyValueExpression(Expression entityExpression, ClassProperty classProperty, DbField dbField)
at RepoDb.Reflection.Compiler.GetDbParameterValueAssignmentExpression(ParameterExpression parameterVariableExpression, Expression entityExpression, ParameterExpression propertyExpression, ClassProperty classProperty, DbField dbField, IDbSetting dbSetting)
at RepoDb.Reflection.Compiler.GetParameterAssignmentExpression(ParameterExpression commandParameterExpression, Int32 entityIndex, Expression entityExpression, ParameterExpression propertyExpression, DbField dbField, ClassProperty classProperty, ParameterDirection direction, IDbSetting dbSetting)
at RepoDb.Reflection.Compiler.GetPropertyFieldExpression(ParameterExpression commandParameterExpression, ParameterExpression entityExpression, FieldDirection fieldDirection, Int32 entityIndex, IDbSetting dbSetting)
at RepoDb.Reflection.Compiler.GetIndexDbParameterSetterExpression[TResult](ParameterExpression commandParameterExpression, Expression entitiesParameterExpression, IEnumerable`1 fieldDirections, Int32 entityIndex, IDbSetting dbSetting)
at RepoDb.Reflection.Compiler.CompileDataEntityListDbParameterSetter[TEntity](IEnumerable`1 inputFields, IEnumerable`1 outputFields, Int32 batchSize, IDbSetting dbSetting)
at RepoDb.Reflection.FunctionFactory.CompileDataEntityListDbParameterSetter[TEntity](IEnumerable`1 inputFields, IEnumerable`1 outputFields, Int32 batchSize, IDbSetting dbSetting)
at RepoDb.FunctionCache.DataEntityListDbParameterSetterCache`1.Get(String cacheKey, IEnumerable`1 inputFields, IEnumerable`1 outputFields, Int32 batchSize, IDbSetting dbSetting)
at RepoDb.FunctionCache.GetDataEntityListDbParameterSetterCompiledFunction[TEntity](String cacheKey, IEnumerable`1 inputFields, IEnumerable`1 outputFields, Int32 batchSize, IDbSetting dbSetting)
at RepoDb.Contexts.Providers.InsertAllExecutionContextProvider.CreateInternal[TEntity](IDbConnection connection, String tableName, IEnumerable`1 dbFields, Int32 batchSize, IEnumerable`1 fields, String hints, IDbTransaction transaction, IStatementBuilder statementBuilder)
at RepoDb.Contexts.Providers.InsertAllExecutionContextProvider.Create[TEntity](IDbConnection connection, String tableName, Int32 batchSize, IEnumerable`1 fields, String hints, IDbTransaction transaction, IStatementBuilder statementBuilder)
at RepoDb.DbConnectionExtension.InsertAllInternalBase[TEntity](IDbConnection connection, String tableName, IEnumerable`1 entities, Int32 batchSize, IEnumerable`1 fields, String hints, Nullable`1 commandTimeout, IDbTransaction transaction, ITrace trace, IStatementBuilder statementBuilder)
at RepoDb.DbConnectionExtension.InsertAllInternal[TEntity](IDbConnection connection, String tableName, IEnumerable`1 entities, Int32 batchSize, IEnumerable`1 fields, String hints, Nullable`1 commandTimeout, IDbTransaction transaction, ITrace trace, IStatementBuilder statementBuilder)
at RepoDb.DbConnectionExtension.InsertAll[TEntity](IDbConnection connection, IEnumerable`1 entities, Int32 batchSize, IEnumerable`1 fields, String hints, Nullable`1 commandTimeout, IDbTransaction transaction, ITrace trace, IStatementBuilder statementBuilder)
at Db.Fn.writeEvents() in /Users/swoorup.joshi/RiderProjects/Playground/Playground/Db.fs:line 71
I have a a record defined as follows:
Apparently inserting using InsertAll throws up an error about the nullable type.