Quantcast
Channel: EntityFramework Reverse POCO Code First Generator
Viewing all articles
Browse latest Browse all 1642

Commented Unassigned: Foreign keys not generated for a composite FK [142]

$
0
0
Note: This might be related to [Issue141](https://efreversepoco.codeplex.com/workitem/141)

Given the tables that have the following definitions:
```
-- TABLE A
CREATE TABLE [dbo].[A](
[AId] [int] IDENTITY(1,1) NOT NULL,
[C1] [int] NOT NULL,
[C2] [int] NOT NULL,
CONSTRAINT [PK_A] PRIMARY KEY CLUSTERED
(
[AId] ASC
)
ALTER TABLE [dbo].[A] WITH CHECK ADD CONSTRAINT [FK_A_A] FOREIGN KEY([C1], [C2])
REFERENCES [dbo].[XREF] ([C1], [C2])
```
```
-- TABLE XREF
CREATE TABLE [dbo].[XREF](
[C1] [int] NOT NULL,
[C2] [int] NOT NULL,
[CreatedUTC] [datetime2](7) NOT NULL,
CONSTRAINT [PK_XREF] PRIMARY KEY CLUSTERED
(
[C1] ASC,
[C2] ASC
)
-- with C1 and C2 each having FKs to other tables..
```

No foreign keys are generated in the model from Table A to table XREF in the config classes (no virtual collections for the relationships etc.).

Comments: To get you by, in CalcRelationship(), change: ``` return Relationship.DoNotUse; ``` to ``` return Relationship.OneToOne; ```

Viewing all articles
Browse latest Browse all 1642

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>