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

Created Unassigned: Foreign key compile error - Duplicate anonymoous type property name [160]

$
0
0
I have the following Foreign key on a table in my DB:
```
ALTER TABLE [Ops].[FCMarketMapping] WITH CHECK ADD CONSTRAINT [FK_FCMarketMapping_markets] FOREIGN KEY([MarketId])
REFERENCES [reference].[markets] ([id])
GO
```
This leads to an error in the auto-generated configuartion file:
```
// Foreign keys
HasRequired(a => a.Markets).WithMany(b => b.FcMarketMapping).HasForeignKey(c => new { c.MarketId, c.MarketId }); // FK_FCMarketMapping_markets
```
The compile error is "Duplicate anonymous type property name MarketId"

I just keep having to manually comment out the auto-generated line as I don't want to remove the key from the DB. Am I doing something wrong? Anyone else having this issue?

Viewing all articles
Browse latest Browse all 1642

Trending Articles



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