LLBLGen Pro 5.7.3, using Database First:
I believe this is a both a reverse engineer and designer issue, not related to the target framework.
Scenario: (MSSQL server)
With SQL tables configured as below
CREATE TABLE dbo.A (
Pk1 INT not null primary key
);
CREATE TABLE dbo.C (
Pk1 INT not null,
Pk2 INT not null,
[Data] nvarchar(100) null,
CONSTRAINT [PK_C] PRIMARY KEY (Pk1,Pk2),
CONSTRAINT [FK_C_A] FOREIGN KEY (Pk1) REFERENCES dbo.A (Pk1)
);
CREATE TABLE dbo.B (
Pk1 INT not null,
Pk2 INT not null,
Link INT null,
CONSTRAINT [PK_B] PRIMARY KEY (Pk1,Pk2),
CONSTRAINT [FK_B_A] FOREIGN KEY (Pk1) REFERENCES dbo.A (Pk1),
CONSTRAINT [FK_B_Link] FOREIGN KEY (Pk1,Link) REFERENCES dbo.C (Pk1,Pk2)
);
There are two issues around this.
-
When reverse engineering Tables to Entities, the model created sets field B.Link as not optional.
-
If edit B.Link in designer, and set the "Optional" flag (so correct underlying object model is created), then renaming the Navigator associate with B.Link causes the "Optional" flag for B.Link to be cleared.
Inspecting the Model Relational data (created by database first process) confirms that B.Link field has correctly has the "Is Nullable" value set to True.
If the "Optional" flag for B.Link is not manually corrected before generating code, this bug results in broken code where entities of type B cannot be loaded if any of the rows contain NULL entries for Link column.