Association in Entity Framework 4
- by Marsharks
I have two tables, a problem table and a problem history table. As you can expect, a problem can have many histories associated with it.
CREATE TABLE [dbo].[Problem](
[Last_Update] [datetime] NULL,
[Problem_Id] [int] NOT NULL,
[Incident_Count] [int] NULL
)
ALTER TABLE [dbo].[Problem] ADD CONSTRAINT [PK_Problem] PRIMARY KEY CLUSTERED
(
[Problem_Id] ASC
)
CREATE TABLE [dbo].[Problem_History](
[Last_Update] [datetime] NULL,
[Problem_Id] [int] NOT NULL,
[Severity_Chg_Flag] [char](1) NULL
) ALTER TABLE [dbo].[Problem_History] ADD [Create_DateTime] [datetime] NOT NULL
ALTER TABLE [dbo].[Problem_History] WITH CHECK ADD CONSTRAINT [FK_Problem_History_Problem] FOREIGN KEY([Problem_Id])
REFERENCES [dbo].[Problem] ([Problem_Id])
The problem is when I drag this into an Entity Model, the associations are not included. Any ideas? I would like to point out that the problem history table has no separate key of its own, it shares the problem id