Thanks nemesv for the tip in your comment! What I was missing was that the types are specified when setting the parameters of the stored procedure, that is, "Int" and "String" in:
c => new { ItemID = c.Int(), ItemName = c.String(),
... are actually methods, and each of these methods - on the System.Data.Entity.Migrations.Builders.ParameterBuilder class - has a set of optional parameters that affect the SQL generated from the migration script.
In the case of the smallmoney -type stored procedure smallmoney , I ended up using:
ItemCost = c.Decimal(precision: 10, scale: 4, storeType: "smallmoney")
Accuracy values: 10 and scale: 4 from the MSDN article money and smallmoney (Transact-SQL) , which indicates that smallmoney has an accuracy (total number of digits) of 10 and a scale (# digits to the right of the decimal point) 4 (for SQL Server 2008 and above).
So my full transition code:
public override void Up() { this.AlterStoredProcedure("dbo.EditItem", c => new { ItemID = c.Int(), ItemName = c.String(), ItemCost = c.Decimal(precision: 10, scale: 4, storeType: "smallmoney") }, @" (New sproc body SQL goes here) "); }
What caused SQL:
ALTER PROCEDURE [dbo].[EditItem] @ItemID [int], @ItemName [nvarchar](max), @ItemCost [smallmoney] AS BEGIN (New sproc body SQL goes here) END
Jon Schneider Dec 30 '15 at 19:30 2014-12-30 19:30
source share