Guest User

Untitled

a guest
Jul 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. [LazyLoad] private IProductRepository _productRepository;
  2.  
  3. public class LazyLoadAttribute : LocationInterceptionAspect
  4. {
  5. public override void OnGetValue(LocationInterceptionArgs args)
  6. {
  7. if (args.Value == null)
  8. {
  9. var locationType = args.Location.LocationType;
  10. var instantiation = ObjectFactory.GetInstance(locationType);
  11.  
  12. if (instantiation != null)
  13. {
  14. args.SetNewValue(instantiation);
  15. }
  16. }
  17. args.ProceedGetValue();
  18. }
  19. }
Add Comment
Please, Sign In to add comment