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
{{ message }}
This repository was archived by the owner on Nov 28, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
1
ServiceStack.Text.EnumMemberSerializer
2
2
======================================
3
3
4
-
Extension for ServiceStack.Text to allow using EnumMember attributes to serialize and deserialize enumerations. This allows you to use more human readable values while still leveraging the benefits of using enumerations.
4
+
Extension for [`ServiceStack.Text`](https://github.com/ServiceStack/ServiceStack.Text) to allow using [`EnumMemberAttribute`](http://msdn.microsoft.com/en-us/library/system.runtime.serialization.enummemberattribute.aspx) to serialize and deserialize enumerations. This allows you to use more human readable values while still leveraging the benefits of using enumerations.
5
+
6
+
Custom enumeration serialization currently only applies to the json serializer. It works by assigning custom delegates to [`JsConfig<T>.SerializeFn`](https://github.com/ServiceStack/ServiceStack.Text/blob/master/src/ServiceStack.Text/JsConfig.cs) and [`JsConfig<T>.DeSerializeFn`](https://github.com/ServiceStack/ServiceStack.Text/blob/master/src/ServiceStack.Text/JsConfig.cs).
5
7
6
8
#Example Configuration
7
9
@@ -94,6 +96,12 @@ Without ServiceStack.Text.EnumMemberSerializer:
94
96
}
95
97
]
96
98
```
99
+
#Considerations
100
+
* Only configures public enumerations.
101
+
*`.WithNamespaceFilter()` only applies to filtering public enums found in the assemblies passed in using `.WithAssemblies()`. Any enumerations explicitly identified `.WithEnumTypes()` will not be filtered by namespace. The namespace filter applies to all provided assemblies.
102
+
* Multiple calls to `.WithEnumTypes()` and `.WithNamespaceFilter()` will be added and not replace previous specified values.
103
+
* This manipulates the static `JsConfig<T>`. Other code called later may overwrite the custom serialization/deserialization delegates.
104
+
* Both `.WithEnumTypes()` and `.WithAssemblies()` may be used at the same time, the results will be combined.
0 commit comments