This question is locked. New answers and comments are not allowed.
Hello,
I have noticed two rather strange issues regarding DB first creation of an entity model for a SQLite database.
Consider the following DDL:
CREATE
TABLE
[Warehouses] (
[pk_Warehouse_ID]
integer
,
[
Name
] nvarchar(254)
NOT
NULL
,
PRIMARY
KEY
([pk_Warehouse_ID])
CONSTRAINT
[pk_Warehouses]
);
CREATE
TABLE
[Bins] (
[pk_Bin_ID]
integer
,
[fk_Warehouse_ID]
integer
,
[
Name
] nvarchar(254)
NOT
NULL
,
PRIMARY
KEY
([pk_Bin_ID])
CONSTRAINT
[pk_Bins],
CONSTRAINT
[ref_Bins_Warehouses]
FOREIGN
KEY
([fk_Warehouse_ID])
REFERENCES
[Warehouses]([pk_Warehouse_ID])
);
The above schema works fine when clicking "Update From Database..." in the rlinq designer in Visual Studio. The foreign key relationships are created and appear in the design view as expected.
However, remove the space between "FOREIGN KEY" and "([fk_Warehouse_ID])", recreate the database, update in the designer and suddenly it loses all relationships/associations.
Good line:
CONSTRAINT
[ref_Bins_Warehouses]
FOREIGN
KEY
([fk_Warehouse_ID])
REFERENCES
[Warehouses]([pk_Warehouse_ID])
Bad line:
CONSTRAINT
[ref_Bins_Warehouses]
FOREIGN
KEY
([fk_Warehouse_ID])
REFERENCES
[Warehouses]([pk_Warehouse_ID])