Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>NHibernate supports <a href="https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html_single/#mapping-types-basictypes" rel="noreferrer">DateTime, Ticks, TimeSpan and Timestamp</a>. Make sure you are specifying the type explicitly on your mapping element as the different time types have different semantics so what NHibernate is guessing may not be correct.</p> <p>If you are and are still having problems, modify your post to include the relevant portions of your entity, mapping file, and the actual problem you are encountering.</p> <p><strong>Edit:</strong></p> <p>For example, with the following class for a <code>TimeSpan</code>:</p> <pre><code>public class MyClass { // Other properties // ... // ... public virtual TimeSpan MyTimeProperty { get; set; } } </code></pre> <p>And the mapping file:</p> <pre><code>&lt;!-- other properties --&gt; &lt;property name="MyTimeProperty" type="TimeSpan" /&gt; &lt;!-- Note: NH expects the DB type to be DbType.Int64 --&gt; </code></pre> <p>You indicate that you're trying to map a TimeSpan ("nhibenate dont know to convert time field from db to a timespan, only string"). If this is the correct type matching between .NET (<code>typeof</code> <code>TimeSpan</code>) and the database (<code>DbType.Int64</code>), NH should do this automatically (i.e. you shouldn't need to specify <code>type="TimeSpan"</code>). So if it's not working, I suspect there is a problem with the way you have things setup. It may be helpful if you post the property/field declaration with full signature, the <code>&lt;property&gt;</code> line for this property from your mapping file, and the column definition from the database.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload