Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. public class Person
  2. {
  3. [Dependency]
  4. public IStudent Student { get; set; }
  5. [Dependency]
  6. public ITeacher Teacher { get; set; }
  7.  
  8. public Person()
  9. {
  10.  
  11. }
  12.  
  13. public void SendNotification()
  14. {
  15. if(Student != null)
  16. {
  17. Student.SentMessage("This is a Test Message");
  18. }
  19. }
  20. }
  21.  
  22. IUnityContainer container = new UnityContainer();
  23. container.LoadConfiguration();
  24.  
  25. Person p = (Person)Activator.CreateInstance(typeof(Person));
  26. Person builtUpPerson = (Person)container.BuildUp<Person>(p);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement