I have 3 entity (Projects / Products / Negotiations).
Negotiations entity have a column named ReferencedId and TypeId which ReferencedId is foreign key for both Projects and Products table. TypeId has define ReferencedId is belong to which entity.
But when I call context.SaveChanges(); to insert new message in Negotiation entity, this error has been thrown:
Server Error in '/' Application.
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_ProjectNegotiation". The conflict occurred in database "MyMVCApp", table "dbo.Projects", column 'Id'.
The statement has been terminated.
EDIT :
This is my model:

What can I do to use 1 column as foreign key for Negotiations entity and avoid of use 2 column for this.
Thanks.
As you say – this is a conceptual problem.. you are misusing a Foreing Key. Don’t do this!
Make Negotiations abstract, create ProductNegotiations and ProjectNegotiations as subclasses of Negotiations and define your navigation propterties there