A
A
Aleksandr Salamatov2017-08-18 20:29:42
.NET
Aleksandr Salamatov, 2017-08-18 20:29:42

How to implement a one-to-many relationship in a single EF CodeFirst table?

Good afternoon! How to make a one-to-many relationship in one table?

public class Author
    {
        public Author()
        {
            Followers = new List<Author>();
        }

        public int Id { get; set; }

        [Required]
        [MaxLength(100)]
        public string Name { get; set; }

        public virtual List<Author> Followers { get; set; }
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question