Firebase. Firestore. FirestoreEnumNameConverter< T >
Custom converter which uses enum value names instead of integer values as the Firestore representation.
Summary
This converter is not used by default; it must be configured in the same way as any other custom converter.
Currently this is always case-sensitive, with no customization of the names used. In future releases we may introduce further ways to configure this converter, but the default behavior will remain the same.
When the same enum value has multiple names, no guarantee is made about which one is returned, although both are accepted for conversion back to enum values. You are strongly encouraged not to use multiple names for the same value.
Details | |||
---|---|---|---|
Template Parameters |
|
Inheritance
Inherits from: FirestoreConverter< T >
Public functions |
|
---|---|
FromFirestore(object value)
|
override T
|
ToFirestore(T value)
|
override object
Converts an enum value to its name.
|
Public functions
FromFirestore
override T FromFirestore( object value )
ToFirestore
override object ToFirestore( T value )
Converts an enum value to its name.
If multiple values in the enum map to the same integer, it is undefined which will be returned. If the value is not a named enum element, an exception is thrown, even if the enum is decorated with FlagsAttribute.
Details | |||
---|---|---|---|
Parameters |
|
||
Exceptions |
|
||
Returns |
The name of the value.
|