Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
how to set foregin key in model
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
jothi kumar
10y
1.9k
1
Reply
hi to all,
Here i want to set foregin key for employee id but while running code first migration i got a error.How to resolve it.
MODEL DESCRIPTION:-
[Required]
[ForeignKey("Employee_Id")]
public int Employee_Id { get; set; }
ERROR DESCRIPTION:-
The property 'Employee_Id' cannot be configured as a navigation property. The property must be a valid entity type and the property should have a non-abstract getter and setter. For collection properties the type must implement ICollection
where T is a valid entity type.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
how to create paging in table in mvc 5
how to set compare validator for two text box in mvc