05-11 Value Converters(值转换器 )
There are situations when it is necessary to persist non-persistent property type values in a database. While this requirement can be addressed by creating an additional persistent property and performing the conversion between values, XPO provides a built-in mechanism for such scenarios. The Value Converter is a class that encapsulates conversion methods and can be reused for different properties. A value converter’s conversion algorithms are usually applied when the property value is loaded from or saved to the database.
在某些情况下,需要在数据库中持久化非持久化属性类型值。虽然可以通过创建额外的持久化属性并执行值之间的转换来满足这一要求,但XPO为此类场景提供了一种内置机制。值转换器是一个封装转换方法的类,可以为不同的属性重用。值转换器的转换算法通常在属性值从数据库加载或保存到数