I've created a simple parameterless stored procedure which I've pasted below. I've imported the stored procedure to my Entity Model and created a Function Import. The function in the model is never created and I am unable to execute this stored procedure using the ADO.NET Entity Framework. I've opened the .edmx file in XML view and have confirmed there are no errors regarding this stored procedure. What am I doing wrong? Is it really impossible to call such a simple stored procedure from the Entity Framework? I've set the return type for the import function to None seeing this stored procedure does not need to return any recordsets or values.
Stored Procedure:
ALTER PROC [dbo].[Inventory_Snapshot_Create]
AS
SET NOCOUNT ON
DECLARE @Inventory_Snapshot_ID int
INSERT INTO Inventory_Snapshots (snapshot_timestamp)
VALUES (GETDATE())
SET @Inventory_Snapshot_ID = SCOPE_IDENTITY()
INSERT INTO Inventory_Snapshot_Products (inventory_snapshot_id,
idProduct, stock)
SELECT @Inventory_Snapshot_ID, idProduct, stock
FROM products
SET NOCOUNT OFF
Code trying to execute stored procedure:
Dim db As New MilkModel
db.Inventory_Snapshot_Create()
First you add it to the model, then you go to the Entity Container, then the Import the function.
Full details here:
http://msdn.microsoft.com/en-us/library/bb896231.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With