/Source/Bifrost.Mimir/ViewModelConvention.cs

# · C# · 27 lines · 23 code · 4 blank · 0 comment · 0 complexity · df91951bb3d1f6379ef31def679b0973 MD5 · raw file

  1. using System;
  2. using Bifrost.Execution;
  3. using Bifrost.Notification;
  4. namespace Bifrost.Mimir
  5. {
  6. public class ViewModelConvention : BaseConvention
  7. {
  8. private readonly NotifyingObjectWeaver _weaver;
  9. public ViewModelConvention()
  10. {
  11. _weaver = new NotifyingObjectWeaver();
  12. }
  13. public override bool CanResolve(Type service)
  14. {
  15. return service.Name.Equals("ViewModel");
  16. }
  17. public override void Resolve(IContainer container, Type service)
  18. {
  19. var proxy = _weaver.GetProxyType(service);
  20. container.Bind(service,proxy);
  21. }
  22. }
  23. }