title: Entity Framework - Mapping decimal(13,0) problem
body: <p>I'm migrating the aplication of my company (that nowadays run over SQL Server and Oracle) to ASP NET MVC and Entity Framework for persistence.</p>
  
  <p>A create my Entity Model based on SQL Server Database e separately I create a SSDL for Oracle (for Oracle I use DevArt dotConnect for Oracle Provider) and I get some pain troubles.</p>
  
  <p>My table primary keys are on SQL Server are of type decimal(13,0) and on Oracle are number(13,0) but Oracle map it's type to Int64 and SQL Server to decimal, but I need that SQL Server map it to Int64.</p>
  
  <p>I make these modification manually on Entity Data Model and for create records it's works fine, but when I have to delete or update some record I got these error:</p>
  
  <p>The specified value is not an instance of type 'Edm.Decimal'
  Parameter name: value</p>
  
  <blockquote>
    <p>at System.Data.Common.CommandTrees.DbConstantExpression..ctor(DbCommandTree commandTree, Object value, TypeUsage constantType)<br>
       at  System.Data.Mapping.Update.Internal.UpdateCompiler.GenerateValueExpression(DbCommandTree commandTree, EdmProperty property, PropagatorResult value)<br>
       at  System.Data.Mapping.Update.Internal.UpdateCompiler.GenerateEqualityExpression(DbModificationCommandTree commandTree, EdmProperty property, PropagatorResult value)<br>
       at  System.Data.Mapping.Update.Internal.UpdateCompiler.BuildPredicate(DbModificationCommandTree commandTree, PropagatorResult referenceRow, PropagatorResult current, TableChangeProcessor processor, Boolean&amp; rowMustBeTouched)<br>
       at  System.Data.Mapping.Update.Internal.UpdateCompiler.BuildDeleteCommand(PropagatorResult oldRow, TableChangeProcessor processor)<br>
       at System.Data.Mapping.Update.Internal.TableChangeProcessor.CompileCommands(ChangeNode changeNode, UpdateCompiler compiler)</p>
  </blockquote>
  
  <p>Someone can help me?</p>
  
  <p>Why Entity Framework mapping are so fixed? It could be more flexible?</p>
  
  <p>Ps.: The error that I got, I suspect that is because of a association.</p>
  
  <p>I have a Entity named Province and another named Country and I think that the association between these Entities are causing the problem at update and delete.</p>
  
  <p>Regards,</p>
  
  <p>Douglas Aguiar</p>