static void Main(string[] args) { //Creating a Student object Student student = new Student { StudentId = 1, FirstName = "Vishal", LastName = "Vadgama", Department = "Information Technology" }; //Creating a teacher object Teacher teacher = new Teacher { TeacherId = 1, FirstName = "Jalpesh", LastName = "Vadgama", Subject = "Computer Applciations" }; //getting container object var container = BuildContainer(); //Resolving student repository var studentRepository = container.Resolve<IStudentRepository>(); //Printing student studentRepository.Print(student); //Resolving teacher repository var teacherRepository = container.Resolve<ITeacherRepository>(); //Printing Teacher teacherRepository.Print(teacher); }
public void Print(Teacher teacher) { Console.WriteLine("Printing Teacher"); Console.WriteLine(string.Format("Teaher id: {0}", teacher.TeacherId)); Console.WriteLine(string.Format("First Name: {0}", teacher.FirstName)); Console.WriteLine(string.Format("Last Name: {0}", teacher.LastName)); Console.WriteLine(string.Format("Subject: {0}", teacher.Subject)); Console.Read(); }