Firestore: more flexible serialization
See original GitHub issueI am having some issues trying to get Firestore API to convert between StringValue
and DDD value objects which are fully convertible from/to string. Let me give an example:
[FirestoreData]
public class UserAccount
{
[FirestoreProperty]
public Email EmailAddress { get; set; }
}
public class Email
{
// Email has a TypeConverter implementation that allow full conversion from/to string
// Email also has implicit operators to allow direct conversion from/to string
}
When calling snapshot.ConvertTo<UserAccount>()
, ValueDeserializer
fails with System.ArgumentException: 'Unable to convert value type StringValue to Email'
.
It seems ValueDeserializer
ignores type converters and implicit operators completely.
Issue Analytics
- State:
- Created 5 years ago
- Comments:19
Top Results From Across the Web
Serialize a Firestore query for execution elsewhere
To authenticate to Firestore, set up Application Default Credentials. For more information, see Set up authentication for a local development environment. View ...
Read more >Transaction serializability and isolation | Firestore
Firestore upholds serializable isolation and guarantees that: Firestore commits transactions in order by commit time.
Read more >Map Cloud Firestore data with Swift Codable - Firebase
Swift's Codable API provides a powerful and flexible way to map data from serialized formats to and from your applications data model. In...
Read more >Manage and deploy Firebase Security Rules - Google
Rules must be smaller than 256 KiB of UTF-8 encoded text when serialized. ... The management API gives you the greatest flexibility.
Read more >Firestore custom `toObject` deserialization
Firebase Database and Cloud Firestore cannot serialize arbitrary Java objects to the database. You'll have to write code to pick just the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
PR #2734 is the first pass of the “real” version of this.
Great! Thank you very much. I will give it a try next week.