I have the following table. When i try to insert records using LINQ to SQL it works fine until I try to insert a record where the UserId is null. When I try that I get the following error
"UNIQUE KEY constraint Cannot insert duplicate key in object"
I am only trying to insert 1 record and the table is empty so there is definitely no clash on the unique constraint.
CREATE TABLE [dbo].[QuickViewUserModule](
[QuickViewUserModuleId] [int] IDENTITY(1,1) NOT NULL,
[QuickViewModuleId] [int] NOT NULL,
[UserId] [int] NULL,
[SortOrder] [tinyint] NOT NULL,
... More key stuff ...
CONSTRAINT [IX_QuickViewUserModule] UNIQUE NONCLUSTERED (
[UserId] ASC,
[QuickViewModuleId] ASC)
)