iqtoolkit icon indicating copy to clipboard operation
iqtoolkit copied to clipboard

DbEntityProvider.GetTable<...>() throws ArgumentNullException

Open alimbada opened this issue 1 year ago • 0 comments

I'm trying to insert data into a SQLite DB using LinqPad which uses IQToolkit. The code below throws this exception (~~no stacktrace~~) when provider.GetTable<...>() is called:

ArgumentNullException: Value cannot be null.
Parameter name: key
var mailData = new Mail { // snip };

var provider = this.EntityProvider;
var mailTable = provider.GetTable<Mail>();
mailTable.Insert(mailData);

Edit: found the stacktrace

   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at IQToolkit.Data.Mapping.AttributeMapping.GetEntity(Type elementType, String tableId, Type entityType)
   at IQToolkit.Data.Mapping.AttributeMapping.GetEntity(Type type, String tableId)
   at IQToolkit.Data.EntityProvider.GetTable(Type type, String tableId)
   at IQToolkit.Data.EntityProvider.GetTable[T](String tableId)
   at IQToolkit.Data.EntityProvider.GetTable[T]()
   at UserQuery.Main() in C:\Users\Ammaar.Limbada\AppData\Local\Temp\LINQPad5\_bsgipmuq\query_ziohpo.cs:line 55
   at LINQPad.ExecutionModel.ClrQueryRunner.Run()
   at LINQPad.ExecutionModel.Server.RunQuery(QueryRunner runner)
   at LINQPad.ExecutionModel.Server.StartQuery(QueryRunner runner)
   at LINQPad.ExecutionModel.Server.<>c__DisplayClass151_0.<ExecuteClrQuery>b__0()
   at LINQPad.ExecutionModel.Server.SingleThreadExecuter.Work()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

alimbada avatar Sep 30 '24 12:09 alimbada