Association in Entity Framework 4

Posted by Marsharks on Stack Overflow See other posts from Stack Overflow or by Marsharks
Published on 2010-06-02T14:02:24Z Indexed on 2010/06/02 14:03 UTC
Read the original article Hit count: 183

Filed under:

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

© Stack Overflow or respective owner

Related posts about entity-framework-4