<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dario Quintana &#187; Sql Server 2008</title>
	<atom:link href="http://darioquintana.com.ar/blogging/category/sql-server-2008/feed/" rel="self" type="application/rss+xml" />
	<link>http://darioquintana.com.ar/blogging</link>
	<description>at blogging</description>
	<lastBuildDate>Mon, 18 Apr 2011 04:31:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>NHibernate and Ms Sql Server 2008: Date, Time, DateTime2 and DateTimeOffset</title>
		<link>http://darioquintana.com.ar/blogging/2009/03/12/nhibernate-and-ms-sql-server-2008-date-time-datetime2-and-datetimeoffset/</link>
		<comments>http://darioquintana.com.ar/blogging/2009/03/12/nhibernate-and-ms-sql-server-2008-date-time-datetime2-and-datetimeoffset/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 11:01:59 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Sql Server 2008]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=57</guid>
		<description><![CDATA[<a href="http://darioquintana.com.ar/blogging/2009/03/12/nhibernate-and-ms-sql-server-2008-date-time-datetime2-and-datetimeoffset/" title="NHibernate and Ms Sql Server 2008: Date, Time, DateTime2 and DateTimeOffset"></a>Ms Sql Server 2008 come with a lot of features talking about Date/Time. Besides the already known DbType.DateTime, now we have new types: Date Time DateTime2 DateTimeOffset NHibernate 2.1 introduce changes to support this types out-of-the-box. This table show all &#8230;<p class="read-more"><a href="http://darioquintana.com.ar/blogging/2009/03/12/nhibernate-and-ms-sql-server-2008-date-time-datetime2-and-datetimeoffset/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://darioquintana.com.ar/blogging/2009/03/12/nhibernate-and-ms-sql-server-2008-date-time-datetime2-and-datetimeoffset/" title="NHibernate and Ms Sql Server 2008: Date, Time, DateTime2 and DateTimeOffset"></a><p>Ms Sql Server 2008 come with a lot of features talking about Date/Time. Besides the already known DbType.DateTime, now we have new types:</p>
<ul>
<li><em><strong>Date </strong></em></li>
<li><em><strong>Time </strong></em></li>
<li><em><strong>DateTime2 </strong></em></li>
<li><em><strong>DateTimeOffset</strong></em></li>
</ul>
<p>NHibernate 2.1 introduce changes to support this types out-of-the-box. This table show all the details about how to configurate your system: classes, mappings:</p>
<table border="1" cellspacing="0" cellpadding="2" width="614">
<tbody>
<tr>
<td width="155" valign="top">
<p align="center"><strong>CLR Type </strong></p>
</td>
<td width="111" valign="top">
<p align="center"><strong>DbType </strong></p>
</td>
<td width="152" valign="top">
<p align="center"><strong>Sql Server Type</strong></p>
</td>
<td width="194" valign="top">
<p align="center"><strong>NHibernate type</strong></p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.DateTime</p>
</td>
<td width="111" valign="top">
<p align="center">DateTime</p>
</td>
<td width="152" valign="top">
<p align="center">datetime</p>
</td>
<td width="194" valign="top">
<p align="center">datetime</p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.DateTime</p>
</td>
<td width="111" valign="top">
<p align="center">DateTime2</p>
</td>
<td width="152" valign="top">
<p align="center">datetime2</p>
</td>
<td width="194" valign="top">
<p align="center">datetime2</p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.DateTime</p>
</td>
<td width="111" valign="top">
<p align="center">Date</p>
</td>
<td width="152" valign="top">
<p align="center">date</p>
</td>
<td width="194" valign="top">
<p align="center">date</p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.TimeSpan</p>
</td>
<td width="111" valign="top">
<p align="center">Time</p>
</td>
<td width="152" valign="top">
<p align="center">time</p>
</td>
<td width="194" valign="top">
<p align="center">TimeAsTimeSpan</p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.DateTime</p>
</td>
<td width="111" valign="top">
<p align="center">Time</p>
</td>
<td width="152" valign="top">
<p align="center">time</p>
</td>
<td width="194" valign="top">
<p align="center">time</p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.DateTimeOffset</p>
</td>
<td width="111" valign="top">
<p align="center">DateTimeOffset</p>
</td>
<td width="152" valign="top">
<p align="center">datetimeoffset</p>
</td>
<td width="194" valign="top">
<p align="center">datetimeoffset</p>
</td>
</tr>
</tbody>
</table>
<p>A breaking change was introduced: the old <em>TimeSpan</em> NHibernate type was moved to <em>TimeSpanInt64</em> (it uses a System.Int64).</p>
<p>When we talk about ?NHibernate type?, we are refering to what you?ve to put into your mappings, i.e: <em><strong>&lt;property name=?OnlineMeeting? type=?datetimeoffset?/&gt;</strong> </em>.</p>
<p>To use this features and more you?ve to use the dialect <strong><em>NHibernate.Dialect.MsSql2008Dialect</em></strong>.</p>
<p>The dialect changes include these types and changes to <strong>Hql functions</strong> that return the current system timestamp.</p>
<ul>
<li><strong>current_timestamp</strong>: Now returns the current system timestamp as a DateTime2 value. It uses <em>sysdatetime</em> Sql Server function at background.</li>
<li><strong>current_timestamp_offset</strong>: New function!. Returns the current system timestamp with the offset as a DateTimeOffset value. It uses <em>sysdatetimeoffset</em> Sql Server function at background.</li>
</ul>
<p>The idea of this post isn?t to explain every new type and what it can do, otherwise is to show you what have to do in your classes, queries or mappings to configure your date/time types with NHibernate. Besides, to know every detail of these types you can visit this useful <a href="http://msdn.microsoft.com/en-us/library/bb675168.aspx">.NET Framework Developer&#8217;s Guide</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2009/03/12/nhibernate-and-ms-sql-server-2008-date-time-datetime2-and-datetimeoffset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

