ThinkGeo.com    |     Blog    |     Wiki    |     Support

SqliteFeatureLayer Feature Id is not contained by this SqliteParameterCollection

Hello all,

I keep getting an odd exception when I try to add features to a SqliteFeatureLayer. This code worked in previous versions, but when I converted to .NetCore and Blazor, I keep getting this error:


'A SqliteParameter with ParameterName '@Fid' is not contained by this SqliteParameterCollection.'

System.IndexOutOfRangeException
  HResult=0x80131508
  Message=A SqliteParameter with ParameterName '@id' is not contained by this SqliteParameterCollection.
  Source=Microsoft.Data.Sqlite
  StackTrace:
   at Microsoft.Data.Sqlite.SqliteParameterCollection.IndexOfChecked(String parameterName)
 	ThinkGeo.Core.dll!ThinkGeo.Core.SqliteFeatureSource.ProcessAddBuffer(System.Collections.Generic.Dictionary addBuffer, ThinkGeo.Core.TransactionResult result, Microsoft.Data.Sqlite.SqliteConnection connection)	Unknown
private void AddTiles(List tiles)
        {
            FeatureSource.BeginTransaction();
            foreach (var tile in tiles)
            {
                var colData = tile.colData;
                var features = FeatureSource.GetFeaturesByColumnValue(TILE_INDEX, tile.index);
                if (features.Count > 0)
                {
                    foreach (Feature f in features)
                    {
                        FeatureSource.DeleteFeature(f.Id);
                        FeatureSource.AddFeature(tile.rect, colData);
                    }
                }
                else
                {
                    FeatureSource.AddFeature(tile.rect, colData);
                }
            }

            FeatureSource.CommitTransaction(); <-Exception Thrown here.
        }

@id is the feature id column name. I changed the name of the feature id, and that’s been correlated to the parameter in the error. I confirmed that the columns have been created in the database with other tools. So, I must have to add a new step in creating the database or before attempting to add the tile, or I have to modify code that previously worked. Any help would be greatly appreciated.

Hi Brandon,

Thanks to let us know your questions.

We are looking into it, any news or progress I will let you know.

Regards,

Ethan

Hi Brandon,

That’s a bug and we had fixed it.

Please upgrade your package to please get the package https://www.nuget.org/packages/ThinkGeo.Core/13.0.0-beta052

Any question please let us know.

Regards,

Ethan

I will try it out next week. Unfortunately, I have a demo on Monday, and I don’t want to change the version to a beta version until after the demo. Thanks for the fix. I appreciate it.

Hi Brandon,

Please try this package: https://www.nuget.org/packages/ThinkGeo.Core/12.1.2

I hope that’s able to help you.

Regards,

Ethan

I have able to test it, and I can confirm that it works for me. I apologize for the delay, but I didn’t want to risk breaking other components to change versions of my nuget packages while on a deadline.

Hi Brandon,

Thanks for your updates here, any questions please be free to let us know.

Regards,
Johnny