IN EntityFramework 6 documentation page, in "Concurrency Tokens" section says: (link to document)
Concurrency Tokens
•Update and delete stored procedures may also need to deal with concurrency:
•If the entity contains any concurrency tokens, the stored procedure should have an output parameter named RowsAffected that returns the number of rows updated/deleted.
I created EF6 Code First project, and SQL Server 2012 database, stored procedures also created automatically. But UPDATE and DELETE doesn't have any RowsAffected parameter. Why?
But in documentation it's there.
Documentation shows POCO and Update Storage procedure as:
What is the correct version of strored procedures?
Concurrency Tokens
•Update and delete stored procedures may also need to deal with concurrency:
•If the entity contains any concurrency tokens, the stored procedure should have an output parameter named RowsAffected that returns the number of rows updated/deleted.
I created EF6 Code First project, and SQL Server 2012 database, stored procedures also created automatically. But UPDATE and DELETE doesn't have any RowsAffected parameter. Why?
But in documentation it's there.
Documentation shows POCO and Update Storage procedure as:
public class Person
{
public int PersonId { get; set; }
public string Name { get; set; }
[Timestamp]
public byte[] Timestamp { get; set; }
}
CREATE PROCEDURE [dbo].[Person_Update]
@PersonId int,
@Name nvarchar(max),
@Timestamp_Original rowversion,
@RowsAffected int OUTPUT -- ====> !!!!!
AS
BEGIN
UPDATE [dbo].[People]
SET [Name] = @Name
WHERE PersonId = @PersonId AND [Timestamp] = @Timestamp_Original
SET @RowsAffected = @@RowCount
END
and EF6 created this for me.public partial class POCO
{
//identy
public int ID { get; set; }
// SQL Server Timestamp
// this.Property(t => t.RowVersion).IsFixedLength().HasMaxLength(8).IsRowVersion();
public byte[] RowVersion { get; set; }
public int MiscPropery { get; set; }
}
EntityFramework 6 created insert stored procedure:
CREATE PROCEDURE [dbo].[POCO_Update]
@ID [int],
@RowVersion_Original [rowversion],
@MiscPropery [int]
-- ------- I hope here: @RowsAffected int OUTPUT
AS
BEGIN
UPDATE [dbo].[POCOs]
SET [MiscPropery] = @MiscPropery
WHERE (([ID] = @ID) AND (([RowVersion] = @RowVersion_Original)
OR ([RowVersion] IS NULL AND @RowVersion_Original IS NULL)))
SELECT t0.[RowVersion], t0.[FaturaNo]
FROM [dbo].[POCOs] AS t0
WHERE @@ROWCOUNT > 0 AND t0.[ID] = @ID
END
EntityFramework 6 created delete stored procedure:
CREATE PROCEDURE [dbo].[POCO_Delete]
@ID [int],
@RowVersion_Original [rowversion]
-- ------- I hope here: @RowsAffected int OUTPUT
AS
BEGIN
DELETE [dbo].[POCOs]
WHERE (([ID] = @ID) AND (([RowVersion] = @RowVersion_Original)
OR ([RowVersion] IS NULL AND @RowVersion_Original IS NULL)))
END
In stored procedures created by EF 6, there is no @RowsAffected parameter. Why? What is the correct version of strored procedures?