简体   繁体   中英

Adding an existing table with no Key to an Entity Framework model

I have a legacy table that I need to add to my EDM via VS2012. I have updated the model via the "update model from database" menu choice. This throws the error that a key can not be inferred and adds the remarked out code to the SSDL. I have seen references to creating a compound key in the EDM file to allow the table to be added (read only, which is fine) but have not been able to get it to work.

It involved un-remarking the SSDL, adding a CSDL entry, and CS Mapping.

But I still get errors when trying to run the app about the table in question not being in the Metadata.

Any suggestions or pointers? Adding a key to the actual table is not possible in this case.

TIA

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM