<p>I'm working with LINQ for the first time and wanted to get the Mapping to work when I have a money type in SQL, but my domain object property is of type double.  How can I express this in the XML file, or in code so that the mapping does not throw the usual "invalid cast" exception?</p>

[{'answer_id': 16270, 'author': 'JamesSugrue', 'author_id': 1075, 'author_profile': 'https://Stackoverflow.com/users/1075', 'pm_score': 1, 'selected': False, 'text': '<p>pretty sure Money maps to System.Decimal</p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/bb386947.aspx" rel="nofollow noreferrer">Check here</a></p>\n'}, {'answer_id': 16335, 'author': 'Mark Cidade', 'author_id': 1659, 'author_profile': 'https://Stackoverflow.com/users/1659', 'pm_score': 2, 'selected': True, 'text': '<p>In the DBML XML file, you can set the Expression attribute of a Column element to something like this:</p>\n\n<pre><code> &lt;Column Name="Table1.Amount" DbType="smallint" Type="System.Int32" \n         Expression="CAST(Table1.Amount as int)" /&gt;\n</code></pre>\n'}, {'answer_id': 47171, 'author': 'FlySwat', 'author_id': 1965, 'author_profile': 'https://Stackoverflow.com/users/1965', 'pm_score': 2, 'selected': False, 'text': "<p>Slightly off topic, but this is something everyone should know when working with the Money type in SQLServer.</p>\n\n<p>You don't want to use a double, you want to use a decimal.</p>\n\n<p>A Double is a long float, and floating point arithmetic should never be used for financial calculations.</p>\n\n<p>Think of this, the fractions 1/3, 1/3 and 1/3 equal 1. However, when expressed as a double ie:</p>\n\n<p>.3333 + .3333 + .3333 = .9999 not 1.</p>\n\n<p>You may think that losing a thousandth of a cent is trivial, but its not when your working with someone elses money.</p>\n\n<p>Use System.Decimal.</p>\n"}]
['https://Stackoverflow.com/questions/16265', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']