You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This can become cumbersome, because often, you'd want to use certain filters for lots, if not all, controllers.
You can't use the first option, because you get an exception stating that an item with the same key has already been added to the dictionary. The key is AutofacWebApiFilterProvider.ActionFilterMetadataKey and has a value of "AutofacWebApiActionFilter".
The problem is that in the AsFilterFor method, metadata is constructed that will be unique in the registration (because of a different controller type), but won't be added with a unique metadatakey (always "AutofacWebApiActionFilter").
I'd be happy to fix this and submit a PR, if you're willing to guide me where and how (and if) you'd like it fixed. Can I safely change the metadatakey to be something unique?
The text was updated successfully, but these errors were encountered:
Sorry for the delay in getting back to you on this. It's a good find and we'd love to have a PR for it with associated unit tests.
As you've noticed, the way we figure out the way a service is a filter is by looking at the specific metadata key. If you're able to fix things up so all the filters (action filters, authentication filters, etc.) all work correctly then we'd love a PR for it. I anticipate changing the metadata key may be painful, but I haven't dived in too deep on this.
Anyway, yeah, if you can figure it out, we'd love to see a fix. Thanks!
When registering filters, you can't register one type for multiple controllers like this:
Rather, you'll have to do it per controller separately:
This can become cumbersome, because often, you'd want to use certain filters for lots, if not all, controllers.
You can't use the first option, because you get an exception stating that an item with the same key has already been added to the dictionary. The key is
AutofacWebApiFilterProvider.ActionFilterMetadataKey
and has a value of "AutofacWebApiActionFilter".The problem is that in the
AsFilterFor
method, metadata is constructed that will be unique in the registration (because of a different controller type), but won't be added with a unique metadatakey (always "AutofacWebApiActionFilter").I'd be happy to fix this and submit a PR, if you're willing to guide me where and how (and if) you'd like it fixed. Can I safely change the metadatakey to be something unique?
The text was updated successfully, but these errors were encountered: