Describe what is not working as expected.
If I flag a row as delete and call save change, an error that is raised in SQL Server is not propagated to .NET run time
Steps to reproduce
Create a row that has related data.
Try to delete this row using EF core by flagging an entity as deleted.
Here is the statement generated:
exec sp_executesql N'SET NOCOUNT ON;
DELETE FROM [Contacts].[People]
WHERE [PersonId] = @p0;
SELECT @@ROWCOUNT;
',N'@p0 int',@p0=3
Here is the error raised in SQL Server if I execute the same in SSMS
Msg 547, Level 16, State 0, Line 2
The DELETE statement conflicted with the REFERENCE constraint "FK_COMPANYPERSON_PERSON". The conflict occurred in database "ContactsDatabase", table "Contacts.CompanyPersons", column 'PersonId'.
The statement has been terminated.
However, 0 is still select as part of select @@rowcount
At this point an error should be raised in EF core, but it is not.
EF Core version: 2.0 preview 1
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017
Describe what is not working as expected. If I flag a row as delete and call save change, an error that is raised in SQL Server is not propagated to .NET run time
Steps to reproduce
Create a row that has related data. Try to delete this row using EF core by flagging an entity as deleted. Here is the statement generated: exec sp_executesql N'SET NOCOUNT ON; DELETE FROM [Contacts].[People] WHERE [PersonId] = @p0; SELECT @@ROWCOUNT;
',N'@p0 int',@p0=3
Here is the error raised in SQL Server if I execute the same in SSMS Msg 547, Level 16, State 0, Line 2 The DELETE statement conflicted with the REFERENCE constraint "FK_COMPANYPERSON_PERSON". The conflict occurred in database "ContactsDatabase", table "Contacts.CompanyPersons", column 'PersonId'. The statement has been terminated.
However, 0 is still select as part of select @@rowcount At this point an error should be raised in EF core, but it is not.
EF Core version: 2.0 preview 1 Database Provider: Microsoft.EntityFrameworkCore.SqlServer Operating system: Windows 10 IDE: Visual Studio 2017