If I defined one-to-many relation foreign-key constraints in Sql Server, Is it possible just define and use it in code-first class definitions in one side? For example suppose I have Library and Book classes. Each Library can has many books but each book belong to one library.
public class Book
{
public Book() { }
public int BookId { get; set; }
public string BookName { get; set; }
public virtual Library Library { get; set; }
}
public class Library
{
public Library() { }
public int LibraryId { get; set; }
public virtual ICollection<Book> Books { get; set; }
}
If I want always just use this relation from Book side,Can I don't define below line in Library class definition?
public virtual ICollection<Book> Books { get; set; }