question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firestore: more flexible serialization

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:19

github_iconTop GitHub Comments

1reaction
jskeetcommented, Nov 27, 2018

PR #2734 is the first pass of the “real” version of this.

0reactions
pauloevprcommented, Nov 30, 2018

Great! Thank you very much. I will give it a try next week.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found