IoC Autofac setup #88
Comments
I'm assuming you followed http://www.fluentsecurity.net/wiki/IoC-container-integration ? SecurityContext is setup to be a singleton, so you can't construct one directly. |
On review Autofac and Common ServiceLocator extensions are throwing an exception as I would like to keep the FluentSecurity defaults. Using the following code:
Not sure if it is the best way, but it is working. |
@trustorm I haven't used autofac so I can't tell you the best way. However, you do not need to specify the second argument of ResolveServicesUsing as only the first one is required. Also, you should make sure you return an empty list of objects if TryResolve results in null. |
Another option, if you've configured a custom DependencyResolver (by calling
Then you can override the internal service locator Fluent Security provides as shown in the wiki I linked to previously:
I use Castle Windsor, though, so not sure how well this integrates with Autofac. |
I have tried to setup FluentSecurity with Autofac.
I have got it to a point where is it complaining that it cannot resolve the constructor for SecurityContext.
Is there an example for using FluentSecurity with Autofac?
The text was updated successfully, but these errors were encountered: