just view this link http://www.learnentityframeworkcore.com/configuration/data-annotation-attributes/foreignkey-attribute
public class Book
{
public int BookId { get; set; }
public string Title { get; set; }
public Author Author { get; set; }
[ForeignKey("Author")]
public int AuthorFK { get; set; }
}public class Author
{
public int AuthorId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
[ForeignKey("AuthorFK")]
public ICollection<Book> Books { get; set; }
}why do we need to mention FK columns in two model class ? is it necessary?
what the article try to explain?
if i mention FK in books class does it work or do i need to mention FK in book and author both class ?
please guide.