I have a Customer class that contains a property, MyProperty, which is of a custom type MyCustomType. I want to persist the property value in the database as text. In the designer I've set the Type to 'MyType' and the Server Data Type to 'varchar(10)'. When I build the project I get the following error:
DBML1005: Mapping between DbType 'varchar(10)' and Type 'MyType' in
Column 'MyProperty' of Type 'Customer' is not supported.
Now that make sense, as Linq to Sql has no way of knowing how to convert my custom type. So I'm assuming I have to implement some kind of Parse(string) and ToString() methods on MyCustomType however I can't find any documentation on this.
So, how do I map custom types in Linq to Sql?