Entity Framework バージョン 5.0 を使用して、データベースからエンティティ モデルを構築しました。テーブルの作成には、次の DDL が使用されました。
CREATE TABLE [dbo].[Replenishment](
[replenishmentId] [int] IDENTITY(1,1) NOT NULL,
[locationID] [int] NOT NULL,
[inventoryItemId] [int] NOT NULL,
PRIMARY KEY CLUSTERED
([replenishmentId] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Replenishment]
WITH CHECK ADD CONSTRAINT [FKReplenishm163678]
FOREIGN KEY([inventoryItemId])
REFERENCES [dbo].[InventoryItem] ([inventoryItemId])
GO
ALTER TABLE [dbo].[Replenishment] CHECK CONSTRAINT [FKReplenishm163678]
GO
ALTER TABLE [dbo].[Replenishment]
WITH CHECK ADD CONSTRAINT [FKReplenishm580804]
FOREIGN KEY([locationID])
REFERENCES [dbo].[Location] ([locationID])
GO
ALTER TABLE [dbo].[Replenishment] CHECK CONSTRAINT [FKReplenishm580804]
GO
テーブル Replenishment、Location、および InventoryItem を使用してエンティティ モデルを構築すると、3 つのテーブルすべてがモデルに表示されますが、リレーションシップは表示されません。
外部キーまたはナビゲーション プロパティが表示されない理由を知っている人はいますか?
================================================== ==========================
関連付けられたテーブルからの DDL は次のとおりです。 他の 2 つのテーブルからの ddl は次のとおりです。
CREATE TABLE [dbo].[Location](
[locationID] [int] IDENTITY(1,1) NOT NULL,
[addressID] [int] NULL,
[availabilityStatusID] [int] NOT NULL,
[inLocationId] [int] NULL,
[locationTypeID] [int] NOT NULL,
[locationName] [varchar](40) NOT NULL,
[locationDescription] [varchar](100) NOT NULL,
[locationAnchorX] [int] NULL,
[locationAnchorY] [int] NULL,
[locationImage] [varchar](255) NULL,
[diagramLayerId] [int] NULL,
[locationShapeParameters] [varchar](max) NULL,
[locationHeight] [int] NULL,
[locationWidth] [int] NULL,
[locationColor] [varchar](20) NULL,
PRIMARY KEY CLUSTERED
(
[locationID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[Location] WITH CHECK ADD CONSTRAINT [FKLocation209934] FOREIGN KEY([inLocationId])
REFERENCES [dbo].[Location] ([locationID])
GO
ALTER TABLE [dbo].[Location] CHECK CONSTRAINT [FKLocation209934]
GO
CREATE TABLE [dbo].[InventoryItem](
[inventoryItemId] [int] IDENTITY(1,1) NOT NULL,
[itemTaxonomyId] [int] NOT NULL,
[itemDescription] [varchar](100) NOT NULL,
[itemCode] [varchar](40) NULL,
[batchControlled] [bit] NOT NULL,
[assemblyDefinitionID] [int] NULL,
PRIMARY KEY CLUSTERED
(
[inventoryItemId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO