AuthorizationProvider and SecurityCacheProvider

Topics: Security Application Block
Mar 25, 2010 at 10:13 AM
Hello, I was trying to instantiate IAuthorizationProvider and ISecurityProvider with the EnterpriseLibraryContainer using the following code: IAuthorizationProvider ruleProvider = EnterpriseLibraryContainer.Current.GetInstance<AuthorizationProvider>("Authorization Rule Provider"); ISecurityCacheProvider secCache = EnterpriseLibraryContainer.Current.GetInstance<SecurityCacheProvider>("Security Cache"); But I recieve the following exception: Activation error occured while trying to get instance of type AuthorizationProvider, key "Authorization Rule Provider" Everything works fine when I use the old methods: IAuthorizationProvider ruleProvider = AuthorizationFactory.GetAuthorizationProvider("Authorization Rule Provider"); ISecurityCacheProvider secCache = SecurityCacheFactory.GetSecurityCacheProvider("Security Cache") Can someone tell me what I am doing wrong? Thanks
Mar 26, 2010 at 6:38 AM

Try this

            IAuthorizationProvider ruleProvider = EnterpriseLibraryContainer.Current.GetInstance<IAuthorizationProvider>("Authorization Rule Provider");
            ISecurityCacheProvider secCache = EnterpriseLibraryContainer.Current.GetInstance<ISecurityCacheProvider>("Security Cache");

HTH,

~ginkapitan

 

Mar 26, 2010 at 7:59 AM

It worked! Think I'm gonna have to spend some time studying how  Unity works...

 

Thank you