How to inject Service interface in custom attribute

Feb 12, 2015 at 8:59 PM
Edited Feb 13, 2015 at 12:48 AM
Hi,

I've writing a custom authorization attribute. Just want to find out how I can instantiate the service interface here?

Many thanks.
Coordinator
May 12, 2015 at 5:09 PM
If you can't inject you can use ServiceLocator.Current.GetInstance<ICustomerRepository>() you will need to make sure ServiceLocator adapter is configured for you DI/IoC framework you are using, the sample uses Unity and this is already configured.
Marked as answer by lelong37 on 5/12/2015 at 10:09 AM