pilotboba wrote:
Otis wrote:
No, by applying the type converter, you specify that the field has the .NET type of the typeconverter. The conversion from/to the actual .NET type belonging to the db type of the field is done by the type converter object and is done transparently behind the scenes for you, so you don't see that conversion, the property is NullableDateTime, the value in the EntityField object is NullableDateTime etc.
Ah, I wasn't aware that is how it worked. I assumed I would have to change the type.
No, that's done for you
The type converters have one target type and support for 1 or more sourcetypes. For example, the shipped type converter has as target type System.Boolean and as sourcetype int, byte, sbyte, uint, ushort, short, long and ulong.
I assume the designer uses reflection to determine the return type of the type converter then changes the property type accordingly. Is that what you are saying?
Type converters are derived classes from System.ComponentModel.TypeConverter. This class has nice methods like 'CanConvertFrom' and 'CanConvertTo'. So, when a field selection changes, the editor calls all type converters to see if they can convert from the type of the current field. If so, the type converter is added to the list to select from.
.
So a typeconverter developer just has to implement these methods and it works automatically.