when we call SaveChanges() from DbContext to insert record it will check scope_identity to get row affected and return it, every things is ok, but if we use with link server and synonyms because scope_identiy is local and scope_identiy will return null because it is remote, and it will say :
System.Data.Entity.Infrastructure.DbUpdateConcurrencyException(occurred) Message=Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
becuse DbContext want to execute code like this after insert :
SELECT [Id]
FROM [dbo].[PortalUsers]
WHERE @@ROWCOUNT > 0 AND [Id] = scope_identity()
and scope_identity return null and exception will throwen
can we tell entity that dont check row affected, or something like this to solve problem?