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.