-1

I am a newbie to POCO.I have two tables like tb1 and tb2.Suppose we have a PK and FK relation between these tables.When it come to POCO CF how can we manage this relations?I have a done a sample by following a article.

 public abstract class Person
    {
        public string Name { get; set; }
        public int DepartmentId { get; set; }
        public virtual Department Department { get; set; }
    }

    public class Collaborator : Person
    {
        public int CollaboratorId { get; set; }
        public string ManagerCode { get; set; }
        public virtual Manager Manager { get; set; }
    }

Why they have used the abstract and virtual keywords? Can any one explain me the how can we manage the relations?

Hemant Kumar
  • 4,593
  • 9
  • 56
  • 95

1 Answers1

0

I assume you are using a model-first approach. You will want to use the Fluent API to define the relationships. Here is a good article on how to do this.

Kevin Junghans
  • 17,475
  • 4
  • 45
  • 62