Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [LazyLoad] private IProductRepository _productRepository;
- public class LazyLoadAttribute : LocationInterceptionAspect
- {
- public override void OnGetValue(LocationInterceptionArgs args)
- {
- if (args.Value == null)
- {
- var locationType = args.Location.LocationType;
- var instantiation = ObjectFactory.GetInstance(locationType);
- if (instantiation != null)
- {
- args.SetNewValue(instantiation);
- }
- }
- args.ProceedGetValue();
- }
- }
Add Comment
Please, Sign In to add comment