Beginner |
|
Joined: Tue May 17, 2005 7:25 pm Posts: 43 Location: Somewhere, USA
|
Has anyone else tried to use a property who's type isn't the same as the database field type AND the custom type has an implicit cast operator overload for the database type?
For example, I have a table with an integer field. I also have a class with a "Permissions" field of type Permission class. The permission class has implicit overloads of:
public static implicit operator int(Permission p) {...}
public static implicit operator Permission(int i) {...}
The problem is that the property getter/setters are not using these operators. It only checks for IsAssignableFrom(), then bails out. Why not try direct assignment (IsAssignableFrom), then try cast overloads, IConvertible and TypeConverters in order to try all the ways of getting the data to/from the database?
Smudges
|
|