wtulloch / Blazor.IndexedDB

A Blazor library for accessing IndexedDB
MIT License
140 stars 46 forks source link

[Question] Key path id != defined property Id #5

Closed Reshiru closed 5 years ago

Reshiru commented 5 years ago

Hello,

I have some problems with the key path to my identifier. All data converted to json with: JsonConvert.SerializeObject

Store {"DbVersion":null,"Name":"People","PrimaryKey":{"Name":"Id","KeyPath":"Id","Unique":false,"Auto":true},"Indexes":[{"Name":"FirstName","KeyPath":"FirstName","Unique":false,"Auto":false},{"Name":"LastName","KeyPath":"LastName","Unique":false,"Auto":false}]}

Model

public long Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }

Will store {id: 0, firstName: "a", lastName: "b", Id: 6}

And will resolve (getAll) object {"Id":0,"FirstName":"a","LastName":"b"}

Am I doing something wrong, any clues?

C# Code to set PK schema.PrimaryKey = new IndexSpec { Name = "Id", KeyPath = "Id", Auto = true };

Reshiru commented 5 years ago

Oh well...

First char to lower case fixed it... c: