You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Example of adding the data to the local DB while trying to sync it to the distant DBawait_sqliteConnection.InsertOrReplaceAsync(carInstance);varsupabaseResponse=await_supabaseClient.From<Car>().Upsert(carInstance,queryOptions);
The problem is that the BaseModel (which I need to inherit from because of Supabase) contains properties like BaseUrl, RequestClientOptions, GetHeaders, PrimaryKey, etc. that the SQLite library will try to save, which I obsviously do not want it to, (especially because the PrimaryKey dictionary keys type is not supported so it throws the following error) :
The type 'Supabase.Postgrest.Attributes.PrimaryKeyAttribute' is not a supported dictionary key using converter of type 'System.Text.Json.Serialization.Converters.SmallObjectWithParameterizedConstructorConverter`5[Supabase.Postgrest.Attributes.PrimaryKeyAttribute,System.String,System.Boolean,System.Object,System.Object]'
These properties, on the BaseModel, do have a [Newtonsoft.Json.JsonIgnore] attribute but the SQLite library ignore that because is seems to use System.Text.Json instead of Newtonsoft.Json (regarding to the error above).
Do you have any idea of a workaround to do this ? I'm pretty sure adding the attribute System.Text.Json.Serialization.JsonIgnore to the BaseModel properties would fix it but I can't since it's in the Supabase package.
I'm not really sure of what i'm doing since I'm new to programming in general. Is this the common way to do "offline-first" applications ?
I also apologise if my English isn't the best, it's not my native language.
Thanks you in advance for any help and have a great day,
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm trying to use sqlite-net library in order to save data locally on the user's phone, before syning it to Supabase (for offline-usage).
For convenience, I would like to have a single class representing each table, both the SQLite one and the Supabase one :
The problem is that the BaseModel (which I need to inherit from because of Supabase) contains properties like
BaseUrl
,RequestClientOptions
,GetHeaders
,PrimaryKey
, etc. that the SQLite library will try to save, which I obsviously do not want it to, (especially because thePrimaryKey
dictionary keys type is not supported so it throws the following error) :These properties, on the BaseModel, do have a
[Newtonsoft.Json.JsonIgnore]
attribute but the SQLite library ignore that because is seems to useSystem.Text.Json
instead ofNewtonsoft.Json
(regarding to the error above).Do you have any idea of a workaround to do this ? I'm pretty sure adding the attribute
System.Text.Json.Serialization.JsonIgnore
to theBaseModel
properties would fix it but I can't since it's in the Supabase package.I'm not really sure of what i'm doing since I'm new to programming in general. Is this the common way to do "offline-first" applications ?
I also apologise if my English isn't the best, it's not my native language.
Thanks you in advance for any help and have a great day,
Gabin
Beta Was this translation helpful? Give feedback.
All reactions