NHibernate supports DateTime, Ticks, TimeSpan and Timestamp . Make sure you explicitly point the type to your matching element, since different time types have different semantics, so NHibernate oversight may be wrong.
If you still have problems, modify the message to include the relevant parts of your object, the mapping file, and the actual problem you are facing.
Edit:
For example, with the following class for TimeSpan :
public class MyClass {
And the mapping file:
<property name="MyTimeProperty" type="TimeSpan" />
You indicate that you are trying to match TimeSpan ("nhibenate dont know to convert a time field from db to timepan, only string"). If this is the correct type of correspondence between .NET ( typeof TimeSpan ) and the database ( DbType.Int64 ), NH should do this automatically (ie you do not need to specify type="TimeSpan" ). Therefore, if it does not work, I suspect that there is a problem with the way you have the settings. It may be useful if you publish a property / field declaration with a full signature, the <property> for this property from your mapping file, and the definition of the column from the database.
Stuart childs
source share