Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7766041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:18:52+00:00 2026-06-01T15:18:52+00:00

I am pretty new to Unity & IoC in general & as usual, I

  • 0

I am pretty new to Unity & IoC in general & as usual, I have quickly got myself into a bind…

I have created an Authorization Filter Attribute for the ASP.NET Web API Beta. I now need to inject my Authorizer into the Attribute however since this is an attribute I cannot simply do this public TestAuthAttribute(IAuthorizer Authorizer) in my constructor.

So I then decided to create a public property decorated with the [Dependency] attribute for property injection however it does not get resolved.

Here is the code:

public class TestAuthAttribute : AuthorizationFilterAttribute
{
    [Dependency]
    public IAuthorizer Authorizer { get; set; }

    public TestAuthAttribute() {
        ...
        }

    private bool authorizeCore(HttpRequestMessage request)
    {
        if (Authorizer == null)
            throw Error.ArgumentNull("Null Authorizer");  // <<<<< this is null
    }

When the controller is decorated with the [TestAuth] the Attribute is triggered but the Authorizer is not resolved, it is null)

I have placed the following code in my controller & Authorizer does get resolved…

[Dependency]
    public IAuthorizer Authorizer { get; set; }

Why is this dependency not resolved in my AuthorizationFilterAttribute & how would you go about Injecting the Authorizer into the AuthorizationFilterAttribute?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:18:53+00:00Added an answer on June 1, 2026 at 3:18 pm

    Full disclosure: I have not used Turbine.

    Having said that, I think it might solve your problem for you or at least show you how to solve it.

    They have a Unity Nuget package here: http://nuget.org/packages/MvcTurbine.Unity

    And you can find more detail on their codeplex site here: http://mvcturbine.codeplex.com/

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pretty new to MVC and the like. I have a class the looks like
I'm pretty new to IoC, Dependency Injection and Unit Testing. I'm starting a new
I think I've worked myself into a pretty stupid corner, here. Let me show
I am pretty new to the Unity Application Block and am a little stuck
I have started practicing TDD approach. I am pretty much new to unit testing.
I'm currently looking into unit testing for a new application I have to create.
I have been looking into refactoring some old code into a new WCF service,
I'm pretty new to scala and basically I want to have a couple of
Possible Duplicate: Auto-generation of .NET unit tests I am pretty new to Unit Testing
Pretty new to Perl so there may be a very obvious solution here. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.