<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Technically Speaking</title><subtitle type="html" /><id>http://blogs.msdn.com/sbajaj/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/sbajaj/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/sbajaj/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2008-03-14T00:00:00Z</updated><entry><title>What’s New in LINQ to SQL SP1</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/sbajaj/archive/2008/05/14/what-s-new-in-linq-to-sql-sp1.aspx" /><id>http://blogs.msdn.com/sbajaj/archive/2008/05/14/what-s-new-in-linq-to-sql-sp1.aspx</id><published>2008-05-14T20:26:00Z</published><updated>2008-05-14T20:26:00Z</updated><content type="html">&lt;H1 style="MARGIN: 24pt 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/H1&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;With the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/vstudio/cc533448.aspx"&gt;&lt;FONT face=Calibri size=3&gt;public announcement of the .NET 3.5 SP1 Beta&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;, users of LINQ to SQL must be wondering what it has to offer. In addition to fixes for some of the issues identified by consumers of this technology since it was first released last year, the primary new feature area added to LINQ to SQL is support for some of the new data types in SQL Server 2008. In this blog, I will outline with examples how to use the new data types in LINQ to SQL SP1.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=4&gt;New Data Types in SQL Server 2008&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;SQL Server 2008 introduces several new data types, including Date, Time, DateTime2, DateTimeOffset, and some others. Check out &lt;/FONT&gt;&lt;A href="http://technet.microsoft.com/en-us/magazine/cc434692.aspx"&gt;&lt;FONT face=Calibri size=3&gt;http://technet.microsoft.com/en-us/magazine/cc434692.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; and &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms186724(SQL.100).aspx"&gt;&lt;FONT face=Calibri size=3&gt;http://msdn.microsoft.com/en-us/library/ms186724(SQL.100).aspx&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; for additional information.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;LINQ to SQL introduces support for the following new data types:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Date&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Time&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;DateTime2&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;DateTimeOffset&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Filestream&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Support for Filestream is limited, in that it is mapped as a byte array without any streaming facility, and for the remainder of this blog, I’m going to focus on the Date/Time types and how you can use them.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The code fragments that follow were tested against &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=749BD760-F404-4D45-9AC0-D7F1B3ED1053&amp;amp;displaylang=en"&gt;&lt;FONT face=Calibri size=3&gt;CTP6 of SQL Server 2008&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=4&gt;Mapping the new Date/Time Types&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;By default, the DateTime CLR type in an entity class will map to a column of the SQL type DATETIME, just as it does against SQL Server 2005. However, you can specify the DbType attribute argument in the Column attribute to override the default. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The Time data type is more interesting. LINQ to SQL maps the difference between two DateTime values to a CLR TimeSpan type. For example:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-border-alt: solid windowtext .5pt"&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;DateTime&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; dt = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt;(1960, 01, 01);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;var&lt;/SPAN&gt; query = &lt;SPAN style="COLOR: blue"&gt;from&lt;/SPAN&gt; e &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; db.Employees &lt;SPAN style="COLOR: blue"&gt;select&lt;/SPAN&gt; e.BirthDate.Value - dt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;TimeSpan&lt;/SPAN&gt;&amp;gt; list = query.ToList();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;However, if you have a column of type TIME in your SQL Server 2008 database, you can explicitly map it to a TimeSpan member of an entity class using the DbType attribute argument.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Here’s a class with the new Date/Time types mapped to columns in the database. Note that the CLR DateTime can accommodate the entire range of values allowed in the new SQL DateTime2 type. Also note that there is already a first-class mapping for the SQL DateTimeOffset available in the CLR.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-border-alt: solid windowtext .5pt"&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;Table&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DateTimeTypes&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;Column&lt;/SPAN&gt;(IsPrimaryKey=&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;, CanBeNull=&lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;)] &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; Col_Id;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;Column&lt;/SPAN&gt;(CanBeNull=&lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;, DbType = &lt;SPAN style="COLOR: #a31515"&gt;"DATE"&lt;/SPAN&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt; Col_Date;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;Column&lt;/SPAN&gt;(CanBeNull = &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;, DbType = &lt;SPAN style="COLOR: #a31515"&gt;"TIME(7) NOT NULL"&lt;/SPAN&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;TimeSpan&lt;/SPAN&gt; Col_Time;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;Column&lt;/SPAN&gt;(CanBeNull=&lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt; Col_DateTime2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;Column&lt;/SPAN&gt;(CanBeNull=&lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DateTimeOffset&lt;/SPAN&gt; Col_DateTimeOffset;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;Column&lt;/SPAN&gt;(CanBeNull = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;, DbType = &lt;SPAN style="COLOR: #a31515"&gt;"DATE"&lt;/SPAN&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt;? Col_Nullable_Date;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;Column&lt;/SPAN&gt;(CanBeNull = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;, DbType = &lt;SPAN style="COLOR: #a31515"&gt;"TIME(7) NULL"&lt;/SPAN&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;TimeSpan&lt;/SPAN&gt;? Col_Nullable_Time;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;Column&lt;/SPAN&gt;(CanBeNull=&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt;? Col_Nullable_DateTime2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;Column&lt;/SPAN&gt;(CanBeNull=&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DateTimeOffset&lt;/SPAN&gt;? Col_Nullable_DateTimeOffset;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 10pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;If you have a TIME column mapped to a TimeSpan object, you can invoke the usual TimeSpan properties and expect the appropriate results:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-border-alt: solid windowtext .5pt"&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;long&lt;/SPAN&gt;&amp;gt; ticks = db.DateTimeTypes.Select(c =&amp;gt; c.Col_Time.Ticks).ToList();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;&amp;gt; days = db.DateTimeTypes.Select(c =&amp;gt; c.Col_Time.Days).ToList();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;&amp;gt; hours = db.DateTimeTypes.Select(c =&amp;gt; c.Col_Time.Hours).ToList();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;&amp;gt; mins = db.DateTimeTypes.Select(c =&amp;gt; c.Col_Time.Minutes).ToList();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;&amp;gt; sec = db.DateTimeTypes.Select(c =&amp;gt; c.Col_Time.Seconds).ToList();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;&amp;gt; millisec = db.DateTimeTypes.Select(c =&amp;gt; c.Col_Time.Milliseconds).ToList();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;The corresponding &lt;/FONT&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;TimeSpan.TotalXXX&lt;/SPAN&gt;&lt;FONT face=Calibri&gt; properties also work as expected.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Aggregate operators are also supported, as the example below illustrates:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-border-alt: solid windowtext .5pt"&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DateTimeOffset&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; max1 = db.DateTimeTypes.Select(c =&amp;gt; c.Col_DateTimeOffset).Max();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DateTimeOffset&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; max2 = db.DateTimeTypes.Max(c =&amp;gt; c.Col_DateTimeOffset);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Assert&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.IsTrue(max1 == max2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;In general, we have added support for “natural” use of the new Date/Time types, so that you can write queries like the following:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-border-alt: solid windowtext .5pt"&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;var&lt;/SPAN&gt; query = &lt;SPAN style="COLOR: blue"&gt;from&lt;/SPAN&gt; x &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;db&lt;/SPAN&gt;.Table_With_DateTime2_Column&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;where&lt;/SPAN&gt; x.Col_DateTime2.Year &amp;gt; 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;group&lt;/SPAN&gt; x &lt;SPAN style="COLOR: blue"&gt;by&lt;/SPAN&gt; x.Col_DateTime2 &lt;SPAN style="COLOR: blue"&gt;into&lt;/SPAN&gt; c&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;select&lt;/SPAN&gt; c.Key;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt; dt &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; query)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// ...&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Refer to the documentation accompanying the SP1 Beta for details on the new data types in LINQ to SQL.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=4&gt;New SqlMethods Members&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The SqlMethods class in the System.Data.Linq.SqlClient namespace contains some static methods that allow access to SQL Server functionality that is not otherwise available. For example, the methods DateDiffDay(), DateDiffMonth(), and DateDiffYear() correspond to the DATEDIFF() function in T-SQL.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;In SP1, new overloads of these methods have been introduced. The methods can now accept DateTimeOffset as arguments:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; DateDiffYear(&lt;SPAN style="COLOR: #2b91af"&gt;DateTimeOffset&lt;/SPAN&gt; startDate, &lt;SPAN style="COLOR: #2b91af"&gt;DateTimeOffset&lt;/SPAN&gt; endDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;? DateDiffYear(&lt;SPAN style="COLOR: #2b91af"&gt;DateTimeOffset&lt;/SPAN&gt;? startDate, &lt;SPAN style="COLOR: #2b91af"&gt;DateTimeOffset&lt;/SPAN&gt;? endDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// and others…&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Here’s an example of how you’d use these methods:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-border-alt: solid windowtext .5pt"&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; query = &lt;SPAN style="COLOR: blue"&gt;from&lt;/SPAN&gt; d &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; db.DateTimeOffsets&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;where&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Math&lt;/SPAN&gt;.Abs(&lt;SPAN style="COLOR: #2b91af"&gt;SqlMethods&lt;/SPAN&gt;.DateDiffMinute(d.Startdate, d.EndDate.Value)) &amp;lt;= 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;select&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; { &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;start = d.Startdate, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;end = d.EndDate, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;diff = &lt;SPAN style="COLOR: #2b91af"&gt;SqlMethods&lt;/SPAN&gt;.DateDiffSecond(d.Startdate, d.EndDate)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Additionally, now that SQL Server has support for higher-precision time components (e.g., DateTime2 and DateTimeOffset offer values to within an accuracy of 100 nanoseconds), new members were added to the SqlMethods class:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-border-alt: solid windowtext .5pt"&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; DateDiffNanosecond(&lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt; startDate, &lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt; endDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;? DateDiffNanosecond(&lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt;? startDate, &lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt;? endDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; DateDiffNanosecond(&lt;SPAN style="COLOR: #2b91af"&gt;DateTimeOffset&lt;/SPAN&gt; startDate, &lt;SPAN style="COLOR: #2b91af"&gt;DateTimeOffset&lt;/SPAN&gt; endDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; LINE-HEIGHT: normal; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-layout-grid-align: none; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;? DateDiffNanosecond(&lt;SPAN style="COLOR: #2b91af"&gt;DateTimeOffset&lt;/SPAN&gt;? startDate, &lt;SPAN style="COLOR: #2b91af"&gt;DateTimeOffset&lt;/SPAN&gt;? endDate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Needless to say, the new Nanoseconds methods are for use only against store types that offer the corresponding precision.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=4&gt;Other Improvements&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;In addition to support for the new data types, SP1 also brings fixes for some bugs and performance issues identified since its release last year. Most of these changes were made in direct response to feedback we have received via several channels, including the forums, the &lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/"&gt;&lt;FONT face=Calibri size=3&gt;Connect&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; site, and other means. We are pleased to see the adoption of the technology on the rise and will continue to be responsive to the users’ needs.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=4&gt;Feedback&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I welcome your feedback on anything and everything related to LINQ to SQL and the Entity Framework. Several members of my team and I read the MSDN Forums and attempt to answer questions and concerns raised by users of this technology. Your comments really do matter…keep them coming!&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Thank you.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Samir Bajaj&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Software Design Engineer&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Entity Framework/LINQ to SQL&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8503728" width="1" height="1"&gt;</content><author><name>sbajaj</name><uri>http://blogs.msdn.com/members/sbajaj.aspx</uri></author><category term="LINQ to SQL" scheme="http://blogs.msdn.com/sbajaj/archive/tags/LINQ+to+SQL/default.aspx" /><category term="SQL Server 2008" scheme="http://blogs.msdn.com/sbajaj/archive/tags/SQL+Server+2008/default.aspx" /></entry><entry><title>TPT with LINQ to SQL</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/sbajaj/archive/2008/04/02/tpt-with-linq-to-sql.aspx" /><id>http://blogs.msdn.com/sbajaj/archive/2008/04/02/tpt-with-linq-to-sql.aspx</id><published>2008-04-02T20:18:00Z</published><updated>2008-04-02T20:18:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=verdana,geneva&gt;LINQ to SQL has been gaining popularity since its release last year, and if blogs and forum discussions are any indicator, developers are really pleased with this technology and have been putting it to use in novel ways. &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;At the same time, I’ve seen questions around features and functionality that LINQ to SQL doesn’t offer—one of them being support for inheritance models other than TPH (Table per Hierarchy). Before I discuss that further, I will reiterate some of my comments from an earlier post, specifically, around how LINQ to SQL compares with the Entity Framework. &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;You can find a fair amount of information on the capabilities of LINQ to SQL versus those of the Entity Framework, but let me just say that each technology has specific strengths that make it more appealing in some scenarios over the other. For example, LINQ to SQL would be your best bet in a RAD-like environment with SQL Server as the storage back-end. In Enterprise scenarios that demand more flexibility, the Entity Framework would be the technology of choice. &lt;/FONT&gt;
&lt;H4&gt;&lt;FONT face=verdana,geneva&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;H4&gt;&lt;FONT face=verdana,geneva&gt;Inheritance Hierarchy and O/R Mapping&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;As you may already know, there are three primary strategies for mapping object hierarchies to tables in a relational store. &lt;/FONT&gt;
&lt;H5&gt;&lt;FONT face=verdana,geneva&gt;TPH&lt;/FONT&gt;&lt;/H5&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;In a Table per Hierarchy model, an entire class hierarchy is mapped to one table that contains the union of the attributes from all classes. A discriminator column identifies the object type. Advantages of this approach include simplicity and ease of querying, given that all data resides in one table. On the other hand, this approach does not work well when the classes in the hierarchy change frequently, requiring corresponding changes to the table. &lt;/FONT&gt;
&lt;H5&gt;&lt;FONT face=verdana,geneva&gt;TPT&lt;/FONT&gt;&lt;/H5&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;The Table per Type approach, each class (including abstract classes) is mapped to a table in the database. Data integrity is maintained by introducing foreign keys – often a primary key which is also a foreign key. While this approach most closely resembles the object hierarchy, it has the disadvantage that you have to join several tables for querying and updates. &lt;/FONT&gt;
&lt;H5&gt;&lt;FONT face=verdana,geneva&gt;TPCT&lt;/FONT&gt;&lt;/H5&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;In a Table per Concrete Type strategy, a table is created for each concrete class, with columns corresponding to the attributes of the class as well as those inherited from any abstract bases. I like to think of it as the hybrid approach, where you get some of the advantages of TPH (easier querying) but have to deal with having to update multiple tables corresponding to subclasses of a class that needs to be changed frequently. &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;If you find yourself interested in more on O/R mapping, here’s an excellent article I can recommend: &lt;/FONT&gt;&lt;A href="http://www.ibm.com/developerworks/library/ws-mapping-to-rdb/" mce_href="http://www.ibm.com/developerworks/library/ws-mapping-to-rdb/"&gt;&lt;FONT face=verdana,geneva&gt;http://www.ibm.com/developerworks/library/ws-mapping-to-rdb/&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=verdana,geneva&gt;. &lt;/FONT&gt;
&lt;H4&gt;&lt;FONT face=verdana,geneva&gt;LINQ to SQL and the Entity Framework&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;While LINQ to SQL only supports TPH, the Entity Framework offers all three mapping approaches, and should be the framework of choice when it comes to developing enterprise applications with flexible mapping requirements. &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;Having said that, I wrote the sample application that demonstrates how one can model TPT entities in a LINQ to SQL context using the built-in TPH support and a bit of T-SQL code. The sample is an exercise in exploring different options, and not necessarily a design recommendation. I hope, though, that some of you will find it useful, if only in a didactic sense. &lt;/FONT&gt;
&lt;H4&gt;&lt;FONT face=verdana,geneva&gt;Overview of the Application&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;First, an aside (and a shameless plug): The sample app I wrote is inspired by an application I used to work on—it ships as part of Microsoft Office, and you can check it out at &lt;/FONT&gt;&lt;A href="http://www.ideawins.com/" mce_href="http://www.ideawins.com"&gt;&lt;FONT face=verdana,geneva&gt;http://www.ideawins.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=verdana,geneva&gt;. &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;Consider a hierarchy of classes captured by the following UML diagram. &lt;/FONT&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/TPTwithLINQtoSQL_90D2/clip_image002_2.gif" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/TPTwithLINQtoSQL_90D2/clip_image002_2.gif"&gt;&lt;FONT face=verdana,geneva&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=480 alt=clip_image002 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/TPTwithLINQtoSQL_90D2/clip_image002_thumb.gif" width=377 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/TPTwithLINQtoSQL_90D2/clip_image002_thumb.gif"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=verdana,geneva&gt; &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;Note that only the leaf classes are concrete—the base classes Account, FinancialAccount, and BankAccount are abstract. Now let us assume we wish to reflect this hierarchy in the database. How would we do it? A logical structure in the spirit of TPT would look like the following. &lt;/FONT&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/TPTwithLINQtoSQL_90D2/clip_image004_2.gif" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/TPTwithLINQtoSQL_90D2/clip_image004_2.gif"&gt;&lt;FONT face=verdana,geneva&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=480 alt=clip_image004 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/TPTwithLINQtoSQL_90D2/clip_image004_thumb.gif" width=277 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/TPTwithLINQtoSQL_90D2/clip_image004_thumb.gif"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=verdana,geneva&gt; &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;Note here that the primary keys in the child classes also serve as the foreign keys into parent classes. In fact, there really is only one key per row in each “leaf table.” This schema is about as close as you can get to the original class hierarchy. &lt;/FONT&gt;
&lt;H4&gt;&lt;FONT face=verdana,geneva&gt;Bringing it all together&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;The glue that will allow us to access a TPT-style logical layer with a LINQ to SQL DataContext is a view. The view definition will be a union of rows from the two tables corresponding to the concrete classes, joined to the base tables for the inherited attributes. &lt;/FONT&gt;
&lt;BLOCKQUOTE&gt;
&lt;TABLE class="" cellSpacing=0 cellPadding=2 width=500 border=2&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=496&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;CREATE VIEW dbo.ACCOUNTSVIEW AS &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;SELECT [t0].ID, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t0].ACCOUNTNUMBER, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t0].ACCOUNTNAME, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t1].BALANCE, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t2].BANKNAME, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t2].ACCOUNTHOLDER, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;NULL AS CREDITLIMIT, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;'H' AS Tag &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;FROM ACCOUNT AS [t0] &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;INNER JOIN FINANCIALACCOUNT AS [t1] ON [t0].ID = [t1].ID &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;INNER JOIN BANKACCOUNT AS [t2] ON [t0].ID = [t2].ID &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;INNER JOIN CHECKINGACCOUNT AS [t3] ON [t0].ID = [t3].ID &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;UNION &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;SELECT [t0].ID, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t0].ACCOUNTNUMBER, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t0].ACCOUNTNAME, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t1].BALANCE, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t2].BANKNAME, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t2].ACCOUNTHOLDER, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;[t3].CREDITLIMIT, &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;'C' AS Tag &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;FROM ACCOUNT AS [t0] &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;INNER JOIN FINANCIALACCOUNT AS [t1] ON [t0].ID = [t1].ID &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;INNER JOIN BANKACCOUNT AS [t2] ON [t0].ID = [t2].ID &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;INNER JOIN CREDITCARDACCOUNT AS [t3] ON [t0].ID = [t3].ID&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P mce_keep="true"&gt;&lt;FONT face=verdana,geneva&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;Note that the view includes a discriminator column (‘Tag’) that doesn’t exist in any base table. Now it’s a straightforward matter of mapping this view as a TPH entity to the Account class hierarchy in the application. Once you do that, you can query the database and see that the objects are materialized as expected. &lt;/FONT&gt;
&lt;H5&gt;&lt;FONT face=verdana,geneva&gt;Updates&lt;/FONT&gt;&lt;/H5&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;But we’re not done yet…what about updates? If you try to create new CheckingAccount or CreditCardAccount entities and submit them, SQL Server will complain saying that the view is not updatable. &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;This is the second piece of the puzzle we must resolve, and this is where you roll up your sleeves and write some T-SQL code to work around the limitation. Specifically, an INSTEAD OF INSERT trigger (included in the SQL script with the project) will intercept attempts to insert rows against the view and redirect them to the appropriate base tables. Please refer to the sample code for details. &lt;/FONT&gt;
&lt;H4&gt;&lt;FONT face=verdana,geneva&gt;Prerequisites: Building and Running the Sample&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;This sample is available with complete source code—I’d encourage you to make changes and play with the application. The app was built using &lt;B&gt;Visual Studio 2008&lt;/B&gt; and SQL Server 2005 Express Edition. &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;The Visual Studio solution for the sample contains: &lt;/FONT&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=verdana,geneva&gt;&lt;B&gt;TPT&lt;/B&gt;: This is the (main) console application project. &lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=verdana,geneva&gt;&lt;B&gt;Accounts.bak&lt;/B&gt;: A backup of the database that you can restore on your SQL Server installation—it contains some minimal seed data. &lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=verdana,geneva&gt;&lt;B&gt;Accounts.sql&lt;/B&gt;: The SQL code used to create the database, the various tables, the view and the trigger. &lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;The connection string for the database is stored in the application configuration file—you’ll have to edit it in accordance with your server installation. You can download the sample from &lt;/FONT&gt;&lt;A href="http://code.msdn.com/TPT" mce_href="http://code.msdn.com/TPT"&gt;&lt;FONT face=verdana,geneva&gt;http://code.msdn.com/TPT&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=verdana,geneva&gt;. &lt;/FONT&gt;
&lt;H4&gt;&lt;FONT face=verdana,geneva&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;H4&gt;&lt;FONT face=verdana,geneva&gt;Limitations&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;While the &lt;FONT face=tahoma,arial,helvetica,sans-serif&gt;technique&lt;/FONT&gt; illustrated in the sample application is interesting, there are some drawbacks. First, it won’t work in an environment where the DBA locks down the database and developers aren’t allowed to make any changes to the schema. So if you cannot create views and triggers, this technique is of no use. Secondly, since SQL Server CE does not support views and triggers, this mechanism cannot be employed on that platform. &lt;/FONT&gt;
&lt;H4&gt;&lt;FONT face=verdana,geneva&gt;Feedback&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=verdana,geneva&gt;I’d be interested in finding out what kind of samples and or documentation you’d like to see, both for the Entity Framework as well as LINQ to SQL. If you have ideas, drop me a line at &lt;/FONT&gt;&lt;A href="mailto:linq@live.com" mce_href="mailto:linq@live.com"&gt;&lt;FONT face=verdana,geneva&gt;linq@live.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=verdana,geneva&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8351913" width="1" height="1"&gt;</content><author><name>sbajaj</name><uri>http://blogs.msdn.com/members/sbajaj.aspx</uri></author><category term="LINQ to SQL Entity Framework" scheme="http://blogs.msdn.com/sbajaj/archive/tags/LINQ+to+SQL+Entity+Framework/default.aspx" /></entry><entry><title>SketchPad: A Simple Drawing Editor</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/sbajaj/archive/2008/03/14/sketchpad-a-simple-drawing-editor2.aspx" /><id>http://blogs.msdn.com/sbajaj/archive/2008/03/14/sketchpad-a-simple-drawing-editor2.aspx</id><published>2008-03-14T10:00:00Z</published><updated>2008-03-14T10:00:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Calibri size=3&gt;Aren’t you tired of samples and demos that deal with Customers, Orders, Products, and Categories? Admit it…you’d love to see something different, you’d welcome a fresh perspective, and I know you’ve been waiting patiently. My name is Samir Bajaj; I’m a developer in the Data Programmability team, and I’m here to tell you that the wait is over.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;I’ve wanted to post on this blog for the longest time, and I’ve also known exactly what I’d be writing about, but for one reason or another I’ve not been able to find time to actually do it. I’m sure many of you have been in this situation—you’re so engrossed in working on cool and exciting technology, and with great people, that writing about it often takes a back seat. Well, I finally decided to &lt;I&gt;make&lt;/I&gt; time for this endeavor, not only because I’ve been putting it off for too long, but because I think this is truly novel and enabling technology.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;There is another reason—but first, a brief digression. A few months ago, I wrote a Drawing Editor application based on the Entity Framework. Having worked at a major CAD company before moving to Microsoft, I realized that a Graphics application built on the Entity Framework and backed by an industrial strength relational database like SQL Server would make a compelling demo of the functionality that the framework has to offer. Later, as I began to get familiar with LINQ to SQL, I figured that one way to showcase these two technologies would be to build an application that can switch between the two frameworks while working against the same back end.&lt;/FONT&gt; 
&lt;H4&gt;&lt;FONT face=Calibri color=#000080&gt;A Rudimentary Spatial Database&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;By itself, an application like a Drawing Editor would not be terribly exciting. Sure, it would give you yet another example of how good the Entity Framework is at &lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/aa730866(VS.80).aspx#nxtgenda_topic3" mce_href="http://msdn2.microsoft.com/en-us/library/aa730866(VS.80).aspx#nxtgenda_topic3"&gt;&lt;FONT face=Calibri size=3&gt;bridging the impedance mismatch&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;, but we’ll go a step further, a step closer to a real-world application. I am not going to build a Drawing Editor directly atop the Entity Framework—I’ll give you a taste of a slightly more capable application that truly makes it a different kind of a sample.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;If you haven’t already checked out the &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/sqlserver/2008/en/us/spatial-data.aspx" mce_href="http://www.microsoft.com/sqlserver/2008/en/us/spatial-data.aspx"&gt;&lt;FONT face=Calibri size=3&gt;spatial capabilities of SQL Server 2008&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;, let me just say that it’s one of my favorite new features. In a nutshell, a spatial database supports spatial ADTs like lines, circles and polygons, offers spatial operators like Area and Intersect, and provides spatial indexing for efficient access to such data. &lt;/FONT&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image002_2.gif" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image002_2.gif"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=244 alt=clip_image002 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image002_thumb.gif" width=206 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image002_thumb.gif"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;The sample application that I’ve built comes with a rudimentary spatial layer and a basic, in-memory spatial index. I’ll explain how the application leverages that capability shortly.&lt;/FONT&gt; 
&lt;H4&gt;&lt;FONT face=Calibri color=#000080&gt;LINQ to SQL and the Entity Framework&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;You can find a fair amount of information on the capabilities of LINQ to SQL versus those of the Entity Framework, and I’m not going to delve into that here. Let me just say that each technology has specific strengths that make it more appealing in some scenarios over the other. For example, LINQ to SQL would be your best bet in a RAD-like environment with SQL Server as the storage back-end. In Enterprise scenarios that demand more flexibility, the Entity Framework would be the technology of choice.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;Having said that, I wrote the sample application uses the &lt;/FONT&gt;&lt;A href="http://en.wikipedia.org/wiki/Strategy_pattern" mce_href="http://en.wikipedia.org/wiki/Strategy_pattern"&gt;&lt;FONT face=Calibri size=3&gt;Strategy pattern&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; to allow the user to switch between LINQ to SQL and the Entity Framework for the application data model. Our stack therefore looks like the following (see how the layers map to the conceptual diagram in the previous section).&lt;/FONT&gt; 
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image004_2.gif" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image004_2.gif"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=244 alt=clip_image004 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image004_thumb.gif" width=207 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image004_thumb.gif"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;Note that because I decided to showcase both technologies, my application uses a &lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/bb738443.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb738443.aspx"&gt;&lt;FONT face=Calibri size=3&gt;TPH&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; model, which is supported by both LINQ to SQL as well as the Entity Framework.&lt;/FONT&gt; 
&lt;H4&gt;&lt;FONT face=Calibri color=#000080&gt;Overview of the Application&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;The objective of this exercise is to demonstrate one of the wide varieties of ways in which LINQ to SQL as well as the Entity Framework can be applied. In that spirit, SketchPad is a nowhere near a full-featured drawing editor—it merely illustrates how the data platform technologies can be used to create and enable real-world applications.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;SketchPad is a WinForms-based application that I’d roughly describe as a ‘Notepad for Shapes’. It allows you to retrieve (Read), draw (Create) lines and circles on the canvas and save (Update) them to the database. Select and Delete operations are also available.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;Support for rectangles also exists; however, I use them to highlight the bounding boxes and the spatial index structure. One thing to note in particular is how the sample leverages partial classes, interfaces, and abstract base classes to add “business logic” (in this case, the spatial aspects) into the entities.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;The following UML diagram captures the primary classes of the application at a high level.&lt;/FONT&gt; 
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image006_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image006_2.jpg"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=116 alt=clip_image006 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image006_thumb.jpg" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image006_thumb.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;By default, launching the application will create a LINQ to SQL DataContext to communicate with the store. However, the command-line switch “/ef” will make the application use the Entity Framework instead. The splash screen at launch, as well as the title of the editor window will indicate the runtime in use.&lt;/FONT&gt; 
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image008_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image008_2.jpg"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=176 alt=clip_image008 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image008_thumb.jpg" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image008_thumb.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image010_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image010_2.jpg"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=76 alt=clip_image010 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image010_thumb.jpg" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image010_thumb.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;H4&gt;&lt;FONT face=Calibri color=#000080&gt;Search&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;Search is ubiquitous, and it has become the means of choice for access to any kind of information. One of the “value adds” of this sample is that it combines the scalability of a relational database with a second-level access structure on the geometric data. Just like searching for text in Notepad, you can search for shapes in SketchPad based on specific attributes.&lt;/FONT&gt; 
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image012_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image012_2.jpg"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=218 alt=clip_image012 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image012_thumb.jpg" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image012_thumb.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;The app leverages the index by first querying the database for the location (spatial coordinates) of the objects with the user-specified attributes. The location information is then used to look up the index and identify the shapes on the display. The painting logic subsequently highlights the relevant shapes.&lt;/FONT&gt; 
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image014_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image014_2.jpg"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=154 alt=clip_image014 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image014_thumb.jpg" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image014_thumb.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;While this may appear to be a nice-to-have, you need to imagine the magnitude of the data sets used by GIS and CAD applications, where efficient search is paramount. If you’re an electrical engineer looking for some component in the layout of a multi-million-transistor chip, you’d like to have the layout editor be able to search for the component on the basis of one or more attributes.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;Be sure to check out the other goodies under the Options menu in the application—including index visualization, which animates the process of building the spatial index that the application uses.&lt;/FONT&gt; 
&lt;H4&gt;&lt;FONT face=Calibri color=#000080&gt;Prerequisites: Building and Running the Sample&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;This sample is available with complete source code at &lt;A href="http://code.msdn.com/SketchPad" mce_href="http://code.msdn.com/SketchPad"&gt;http://code.msdn.com/SketchPad&lt;/A&gt; — I would encourage you to make changes and play with the application. The sample only scratches the surface of what the Entity Framework and LINQ to SQL have to offer. Go ahead and feel free to experiment with the sample in order to evolve it and learn more about the exciting new technologies from Microsoft.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;Here’s what you’ll need:&lt;/FONT&gt; 
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Calibri size=3&gt;Microsoft Visual Studio 2008&lt;/FONT&gt; 
&lt;LI&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=15DB9989-1621-444D-9B18-D1A04A21B519&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=15DB9989-1621-444D-9B18-D1A04A21B519&amp;amp;displaylang=en"&gt;&lt;FONT face=Calibri size=3&gt;Entity Framework Beta 3&lt;/FONT&gt;&lt;/A&gt; 
&lt;LI&gt;&lt;FONT face=Calibri size=3&gt;Entity Framework Beta 3 &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=D8AE4404-8E05-41FC-94C8-C73D9E238F82&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=D8AE4404-8E05-41FC-94C8-C73D9E238F82&amp;amp;displaylang=en"&gt;&lt;FONT face=Calibri size=3&gt;Tools December 07 CTP&lt;/FONT&gt;&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;The Visual Studio solution for the sample is comprised of four projects:&lt;/FONT&gt; 
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Calibri size=3&gt;&lt;B&gt;Spatial&lt;/B&gt;: This assembly contains all the spatial logic.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Calibri size=3&gt;&lt;B&gt;LinqToSql&lt;/B&gt;: This is the LINQ to SQL data layer implementation.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Calibri size=3&gt;&lt;B&gt;EF&lt;/B&gt;: This is the Entity Framework data layer implementation.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Calibri size=3&gt;&lt;B&gt;SketchPad&lt;/B&gt;: This is the client (“main”) application that displays the UI and invokes the appropriate entry points in the data layer.&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;Although I used the tools to generate the EDM metadata artifacts from the database for the EF model, I instead opted for manually attributing the classes for the LINQ to SQL model. The sample comes with a database that contains logos of some cars that I sketched using the application. The connection string for the database is stored in the application configuration file—you’ll have to edit it in accordance with your server installation.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;When you launch the app, you’ll be presented with a blank canvas where you can draw lines and circles by choosing the appropriate menu option (from the Draw menu). To display the contents of the pre-seeded database, select the FileàDatabaseà Open menu item&lt;/FONT&gt; 
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image016_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image016_2.jpg"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=119 alt=clip_image016 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image016_thumb.jpg" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image016_thumb.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;When the database connection is opened, the connection string is displayed on the status bar:&lt;/FONT&gt; 
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image018_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image018_2.jpg"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=33 alt=clip_image018 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image018_thumb.jpg" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image018_thumb.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;H4&gt;&lt;FONT face=Calibri color=#000080&gt;Stored Procedure Invocation&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;The database with the sample shapes also has a stored procedure that computes the area of a circle, given its ID (primary key) in the table. You invoke that by selecting a circle on the display, and then using the right-click context menu to call the sproc.&lt;/FONT&gt; 
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image020_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image020_2.jpg"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=200 alt=clip_image020 src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image020_thumb.jpg" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/sbajaj/WindowsLiveWriter/SketchPadASimpleDrawingEditor_14A44/clip_image020_thumb.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;The result will be displayed in the status bar of the main form.&lt;/FONT&gt; 
&lt;H4&gt;&lt;FONT face=Calibri color=#000080&gt;Feedback&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;Needless to say, SketchPad is really the “Hello, World” version of a full-featured, industrial strength drawing editor. However, at its core, it contains elements that you will find in most, if not all, real-world graphics editing software—except with the distinction of the ability to harness the power of a scalable, enterprise-grade relational database like Microsoft SQL Server.&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT face=Calibri size=3&gt;I’d be interested in finding out what kind of samples and or documentation you’d like to see, both for the Entity Framework as well as LINQ to SQL. If you have ideas, drop me a line at &lt;/FONT&gt;&lt;A href="mailto:entities@live.com" mce_href="mailto:entities@live.com"&gt;&lt;FONT face=Calibri size=3&gt;entities@live.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8196897" width="1" height="1"&gt;</content><author><name>sbajaj</name><uri>http://blogs.msdn.com/members/sbajaj.aspx</uri></author><category term="Entity Framework LINQ to SQL Spatial Index" scheme="http://blogs.msdn.com/sbajaj/archive/tags/Entity+Framework+LINQ+to+SQL+Spatial+Index/default.aspx" /></entry></feed>