I’m trying to add a small test table to the dbml designer, but it fails – nothing happends and there is no error message. The table is:
CREATE TABLE [dbo].[Car]
(
CarID INT NOT NULL IDENTITY(1,1)
CONSTRAINT PK_Car PRIMARY KEY CLUSTERED,
RegNo VARCHAR(7) NOT NULL,
ModelID INT NOT NULL
CONSTRAINT FK_Car_Model FOREIGN KEY REFERENCES Model (ModelID)
)
If I drop the FK_Car_Model constraint it works. Am I missing something about how the designer works with relations?
A bit more than a year later, I came across the same situation again and this time it was solved by renaming a foreign key(!).
I have two tables
CarsandPersons.Carshas a columnOwnerIDwhich is a reference to the owner. If the foreign key is namedFK_Car_Ownerit doesn’t work. If the foreign key is renamed toFK_Cars_Ownerit works.