Share via

Xamarin Cannot compile: Parameter System.Collections.Generic.List`1[T] queryArgs

santiago vasquez olarte 1 Reputation point
2021-06-22T17:05:24.44+00:00

I have a problem with a query of SQLite Xamarin

I have installed sqlite-net-pcl 1.7.335 and SQLiteNetExtensions 2.0.0

The process of error is the next:

I fill the variable nuevoRegistro:

DKLgV.png

dataService.InsertOrUpdate<PointOfSaleDTODBModel>(nuevoRegistro);

My model PointOfSaleDTODBModel:

TiTl5.png

I call the method and send it the variable nuevoRegistro

    public T InsertOrUpdate<T>(T model) where T : class, new()
    {
        try
        {
            var oldRecord = DataAccess.GetInstance().Find<T>(model.GetHashCode(), false);
            if (oldRecord != null)
            {
                DataAccess.GetInstance().Update(model);
            }
            else
            {
                DataAccess.GetInstance().Insert(model);
            }

            return model;
        }
        catch (Exception ex)
        {
            ex.ToString();
            return model;
        }
    }

In this step is where i have the problem

    public T Find<T>(int pk, bool WithChildren) where T : class, new()
    {
        return connection.Table<T>().FirstOrDefault(n => n.GetHashCode() == pk);
    }

The error that get is the next:

a9YFJ.png

Error Text:

  • Cannot compile: Parameter"
    • at SQLite.TableQuery1[T].CompileExpr (System.Linq.Expressions.Expression expr, System.Collections.Generic.List1[T] queryArgs) [0x00b16] in <d1788edcec634c19b907698bb77ed371>:0 \n at SQLite.TableQuery1[T].CompileExpr (System.Linq.Expressions.Expression expr, System.Collections.Generic.List1[T] queryArgs) [0x001fb] in <d1788edcec634c19b907698bb77ed371>:0 \n at SQLite.TableQuery1[T].CompileExpr (System.Linq.Expressions.Expression expr, System.Collections.Generic.List1[T] queryArgs) [0x0009d] in <d1788edcec634c19b907698bb77ed371>:0 \n at SQLite.TableQuery1[T].GenerateCommand (System.String selectionList) [0x0005f] in :0 \n at SQLite.TableQuery1[T].ToList () [0x00000] in <d1788edcec634c19b907698bb77ed371>:0 \n at SQLite.TableQuery1[T].FirstOrDefault () [0x00007] in :0 \n at SQLite.TableQuery1[T].FirstOrDefault (System.Linq.Expressions.Expression1[TDelegate] predExpr) [0x00007] in :0 \n at IDS.Helpers.DataAccess.Find[T] (System.Int32 pk, System.Boolean WithChildren) [0x0000e] in /Users/ingeneo/Documents/workspace/Xamarin/dms-mobile/dms-xamarin/IDS-only-login/IDS/Helpers/DataAccess.cs:120 \n at IDS.Services.DataService.InsertOrUpdate[T] (T model) [0x00002] in /Users/ingeneo/Documents/workspace/Xamarin/dms-mobile/dms-xamarin/IDS-only-login/IDS/Services/DataService.cs:54`

Any help, thanks you

Developer technologies | .NET | Xamarin
SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.