3

I use structure map for dependencies injection, I also now want to use postsharp for some authorisation checking at my service layer. because my service layer has all injected repositories is there a way I can inject or pass these repositories to the postsharp attribute to query the sql and provide authorisation?

1 Answer 1

0

I've never used PostSharp - does the code in the PostSharp attributes execute at runtime, or during a post-compile pre-runtime stage?

If the code executes at runtime, you should be able to do service location using a static gateway (ObjectFactory.GetInstance).

1
  • Although this is an old question, PostSharp is a post compile step that injects code into your methods. The code it injects will (obviously) execute at runtime, but after the post compile step the combined code is just another binary.
    – Roman
    Mar 9, 2011 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.