Re: Trouble with decimal precision and scale using Code First
Posted by: Jared Jensen
Date: April 17, 2012 08:27AM

Good to know, thanks. I'm currently working around this limitation for my currency fields with this approach in my DB initalizer:

// Fix currency fields
var currency = new Dictionary<string, string[]>();
currency.Add("Account", new[] { "BillingAmount" });
...(more tables/fields)...
currency.Add("Settings", new[] { "ReturnedPaymentFee", "SalesTaxRate", "ScannerStopBits" });
currency.Add("User", new[] { "HourlyWage" });
foreach (var table in currency.Keys) {
foreach (var field in currency[table]) {
context.Database.ExecuteSqlCommand(String.Format("ALTER TABLE `{0}` CHANGE `{1}` `{1}` DECIMAL(19,4) NOT NULL", table, field));
}
}

Options: ReplyQuote


Subject
Written By
Posted
Re: Trouble with decimal precision and scale using Code First
April 17, 2012 08:27AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.