我有 3 个表,但是当我创建我的 edmx 时,它只在 edmx 模型上显示 2 个。我也无法通过导航访问我的外部参照表。我需要将每个表中的主键 id 插入外部参照表,但我不知道该怎么做,因为我没有获得任何导航属性并且它没有显示在模型中。以下是表格:
CREATE TABLE Message (
id BIGINT(20) NOT NULL AUTO_INCREMENT,
email_body TEXT BINARY NOT NULL,
create_date DATETIME NOT NULL,
PRIMARY KEY (id)
)
CREATE TABLE Address (
id BIGINT(20) NOT NULL AUTO_INCREMEN
PRIMARY KEY (id)
)
CREATE TABLE AddressMessageXref (
message_id BIGINT(20) NOT NULL,
address_id BIGINT(20) NOT NULL,
PRIMARY KEY (message_id, address_id),
INDEX address_id (address_id),
INDEX message_id (message_id),
CONSTRAINT FK_AddressMessageXref_Address_id FOREIGN KEY (address_id)
REFERENCES Address(id) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT FK_AddressMessageXref_Message_id FOREIGN KEY (message_id)
REFERENCES Message(id) ON DELETE RESTRICT ON UPDATE RESTRICT
)
我需要做的是在我插入消息表和地址表之后,我需要将返回的 id 插入到 AddressMessageXref 表中。