简体   繁体   中英

Entity Framework Adding new record with foreign key constraint

In an effort to learn the entity framework I have created two tables in a one to many relationship. The one table (Author) has the following fields - AuthorID, FirstName, LastName. The many table (Payroll) has the following fields - PayrollID, AuthorID, Salary. I have CRUD stored procdures for insert, update and delete. What I am tying to figure-out is how to add new payroll records to the payroll table.

To solve this problem I decided to move my code to Entity Framework 4 where I can have the model generate foreign key relationships. Thanks to all.

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