The SQL Server Compact Edition throws a very unhelpful SqlCeException exception with the message:
"A parameter is missing. [ Parameter ordinal = 1 ]"
when using the entity framwork SaveChanges() method if you set a decimal property to a value with more decimal places than the database column has been configured to store.
For example, if you have a database table "header" with a Numeric 18/3 column "Height" and execute the following code, the "A parameter is missing" will be thrown.
EntityFrameworkSQLCEEntities entities = new
EntityFrameworkSQLCEEntities();
Header header = Header.CreateHeader(Guid.NewGuid(), "Test");
header.Height = Convert.ToDecimal(3.4555);
//header.Height = Decimal.Round(Convert.ToDecimal(3.4555), 3);
entities.AddToHeader(header);
entities.SaveChanges();
Rounding the decimal to the supported number of decimal places prior to setting the property "fixes" this problem but couldn't this be better handled by the Entity Framework and/or SQL Server Compact Edition?