Questions tagged [unity-interception]

Unity is an IOC/DI framework from the Microsoft Enterprise Patterns and Practices Library. It also has cross-cutting (Aspect like) capabilities in the form of Interceptors

Unity allows developers to wire up Interceptors to be injected at the class or method level. This gives the developer the ability to introduce logic that is invoked anytime a method on the configured class/method is called. This magic is possible when Unity is used as an Object Factory, where it creates a dynamic proxy class in front of the implementation class at runtime.

72 questions
2
votes
1 answer

SharpSNMP Implementation Based on snmptrad example stop working

I'm doing an application prototype based on a example included in Sharp-SNMP Library (snmptrapd) to get some data from SNMP protocol but has stopped working at all, by some unknown reason stopped working but don't throw any exception, compiles and…
Rafael
  • 3,081
  • 6
  • 32
  • 53
2
votes
2 answers

Unity Container: create child container around every method call

Can we use Unity interception/extensions/custom proxy to perform this? // psuedo-code using (var childContainer = new container.CreateChildContainer()) using (var scope = new TransactionScope()) { …
Brian Low
  • 11,605
  • 4
  • 58
  • 63
2
votes
1 answer

Microsoft Unity the difference between interface interception and constructor Injection

What's the difference between interface interception and constructor Injection in asp.net unity? I am lack of understanding DI with Unity I am working on an old project and in unity.config, some like this,
Bubble
  • 47
  • 1
  • 5
1
vote
1 answer

How do I configure Unity 2.0 Policy Injection to use custom attribute matching rule in configuration file?

How do I configure Unity 2.0 Policy Injection to use custom attribute matching rule in configuration file? What I want is to translate the following code snippet in the unity configuration file. myContainer.Configure() …
1
vote
1 answer

How to make [HandlerAttribute]-based interception work on everything by default in Unity?

I want to use [HandlerAttribute]-based interception in my project (because it is slightly more obvious to the new developers). However I can't get it to work unless I explicitly specify new InterceptionBehavior() in…
Andrey Shchekin
  • 21,101
  • 19
  • 94
  • 162
1
vote
1 answer

Customizable Behavior using Unity Interception c#

I trying to create Separate Customizable Interception Behavior for specific scenarios such as trace logging, exception logging , Performance logging and combination of mentioned. However , When I created a Custom behavior with Method as…
1
vote
0 answers

Specify policy for an interceptable type

Suppose I have the following code: class Program { static void Main(string[] args) { IUnityContainer container = new UnityContainer(); container.AddNewExtension(); container.RegisterType( new…
1
vote
1 answer

VB.net Attributes on properties get and set

The scenario is that we have written a debugger interceptor using Unity to easily wrap an object to write the timelapse it takes for a method to complete. Sadly, it is also writing all public property get and set invokations. So we simply put an…
1
vote
0 answers

Intercept IEnumerable list of Interface types with Unity DI/IoC

To All That Can Help, I'm new to the Unity container and I'm embarking on a way to filter collections that contain a certain interface by use of interception. The application of interception is new to me, even with my experience with AutoFac and…
1
vote
0 answers

Unity(3.5) Interception in MVC 5

I am trying to use Interception in a MVC application. The problem I am having is with the controllers. Because the controllers are registered in the Unity container, and don't have interfaces, I am getting an error. I think I need a way to…
1
vote
4 answers

Can I get WebApi to work with IoC Aspects/Interceptor

I'm from a WCF background where I successfully used IoC with Aspects/Interceptors to abstract functions such as Authentication and Logging. I would simply just add the required interfaces to the aspects constructor the same way as you would with any…
Steve Parry
  • 366
  • 3
  • 12
1
vote
1 answer

How to use Log4Net with interception (MS Unity)

I am try to use Log4Net with Unity and interception... It looks like everything should work , but doesn't... I've two problem... I think with one solution. When I log into the file, I should log also the method that I'm logging. Infact, I have this…
Simone
  • 2,304
  • 6
  • 30
  • 79
1
vote
0 answers

Defer (lazy creation) or suppress creation of Unity Call Handler Attributes until the decorated method is actually called

I am trying to use Interception Call Handler and Handler Attributes on my interfaces (or implementation). Lets say my Interface has two methods DoSomething() and DoSomethingElse(), and I only have the interceptor for DoSomethingElse(); when I…
1
vote
1 answer

Register instance for interception in Unity

For my Unit Tests I am currently mocking my interceptor and intercepted classes using Moq, then registering the intercepted instance in Unity and setting the default interceptor for the interface. I then resolve the instance and call methods on the…
1
vote
1 answer

Unity Interception MethodSignatureMatchingRule could not be resolved

Im using Unity (3.0) interception to add some crosscutting concerns to my application. Somehow I can't use the MethodSignatureMatchingRule in my configuration getting this error message: {"The type name or alias MethodSignatureMatchingRule could not…