WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Property name inference
editProperty name inference
editAppending suffixes to a lambda expression body
editSuffixes can be appended to the body of a lambda expression, which is useful in cases where you have a POCO property mapped as a multi-field and want to use strongly typed access with a lambda expression, yet append a suffix to the generated field name, in order to access a particular sub field of the multi-field.
The .Suffix()
extension method can be used for this purpose and when serializing expressions suffixed
in this way, the serialized property name resolves to the last token
Expression<Func<Project, object>> expression = p => p.Name.Suffix("raw"); Expect("raw").WhenSerializing<PropertyName>(expression);
Appending suffixes to a Lambda expression
editAlternatively, suffixes can be applied to a lambda expression directly using
the .ApplySuffix()
extension method. Again, the serialized field name
resolves to the last token
Expression<Func<Project, object>> expression = p => p.Name; expression = expression.AppendSuffix("raw"); Expect("raw").WhenSerializing<PropertyName>(expression);