How can I inject (attach) event handlers to .net events of instances created by the Unity IoC container?
Example: I have a class that reports errors via a standard .net event:
class CameraObserver
{
public event Action<Exception> UnhandledException;
[...]
}
I have another class that is reponsible for handling those even...
I have a project that I am experimenting with DI in. I am using Unity and things seem to work well for normal assemblies and the injections.
I am trying to further break dependencies with WCF services. The WCF service that I want to inject is created at runtime currently without using DI and I don't use the VS .net generated proxies:
...
I have something I want to initialise and use throughout a WCF Service Library. If it was in an ASP.NET site I'd be doing it in the Application_Start method of the global.asax, but what's the equivalent for a WCF Service Library?
...
Hi,
i have the following code, and when i try to run it, i can see that the BrokerProvider is not being resolve. here is my code + config:
static void Main(string[] args)
{
IUnityContainer container = new UnityContainer();
UnityConfigurationSection section = (UnityConfigurationSection) ConfigurationMana...
I'm looking for unity tutorials that aren't a download, rather a walk through on a webpage that I can follow along, So far I've found 6 or so tutorials that all use configuration files. I've been doing my own poor man's dependency injection and wanted to pick up a framework finally, so I don't need IoC or DI explained, which many of the ...
I'm putting the unity container creation/setup in the global.asax. and making the container a static property on that class since i'm not sure how unity works or if the container needs to be kept alive and references elsewhere. What's the recommended location of unity initialization/configuration for mvc 2?
...
I have come accross two ways of initializing Views and ViewModels in WPF CAL MVVM.
1 - Seems to be more popular. Requires you to resolve the ViewModel to automatically resolve the View. The ViewModel contains information about the View.
public interface IView
{
void SetModel(IViewModel model);
}
public interfac...
Say I have this class
public class MyObject : IObject
{
public MyObject(IObject2 object2)
{
}
}
which I resolve like:
Container.Resolve<IObject>("SomeName");
Is it possible to configure Unity so that whenever an IObject is resolved using any name, then the IObject2 will also be resolved with that same name (assuming ...
At my job we are using Moq for mocking and Unity for an IOC container. I am fairly new to this and do not have many resources at work to help me out with determining the best practices I should use.
Right now, I have a group of repository interfaces (Ex: IRepository1, IRepository2... IRepository4) that a particular process needs to use ...
Hi!
I wanna write some sort of bowling game on iPhone. I've read about SIO2 and Unity but I want to know developers opinion about what engine fits to my task with minimum efforts. What do you recommend?
thx.
...
I want to use Unity Inteception with WCF to do Authorization on my method calls. I have followed articles to create an IInstanceProvider all the way to the ServiceFactory etc.
I have created a CallHandler to do the Authorization and hook it to methods with an attribute.
My problem is that it only intercepts the methods of the Service, ...
It's sometimes necessary when using dependency injection to provide the parameters to use in the constructor. This is something that's supported in Unity (and other dependency injection containers), so that when it tries to create an instance of the type, it can provide your arguments as parameters in the constructor.
My question is: is...
I'm using the Unity IoC container for resolving my objects. However, I've run into an issue. When I have more than one constructor - how does Unity know which one to use? It seems to use the one with parameters when I have one with and one without. Can I explicitly tell it which constructor to use?
Specifically I had a case similar to ...
I have an interface (call it IAcmeService) that has multiple implementations.
FileSystemAcmeService
DatabaseAcmeService
NetworkAcmeService
The end-user needs to be able to select which implementation will be used and also save that selection.
Currently I'm configuring my IOC container (Unity) to register all the known implemenatation...
I have a WCF service project hosted in IIS. The main SVC file is in the root of the web application folder, and in the bin\ folder are the actual dlls. The web.config (also in the root) contains all the unity mappings. Unfortunately, it seems that because the concrete assemblies etc. are living in the bin\ folder, Unity cannot find them....
We're using constructor-based dependency injection, AutoMapper and Unity on a codebase.
We have wrapped AutoMapper with a generic interface...
public interface IMapper<TSource, TDestination>
{
TDestination Map(TSource source);
}
And a class that implements this interface...
public class AutomaticMapper<TSource, TDestination> : I...
I've written a class that has some dependencies it resolves from the unity container.
From my main class I create a new object
MyObject myObject = new MyObject();
I register it with my Unity Container
UContainer.RegisterInstance<MyObject>(myObject, new ExternallyControlledLifetimeManager());
the I create the type that needs this a...
Hello,
Where can I get the sources for these 2 assemblies? I have some issues with them an would need to debug inside them.
Basically the problem i have is that i register a class with
container.RegisterType<Interface, Type>()
and in some cases i get a new instance, and in other cases i get an old instance of the class.
Edit:
I...
In a follow up to Krzysztof’s statement that Windsor does a lot more than other IoC’s, I wanted to understand how these IoC’s stack up against each other and the benefits/additional facilities that castle Windsor provides.
Are there any comparisons? Can someone help me understand the additional features that Castle Windsor provides ov...
I followed Jason Dollinger's MVVM sample from Lab49 to learn the basics of using Unity with an MVVM WPF application. I constructed a simple sample following his basic architecture, using property injection and the Dependency attribute to inject viewmodels into the views. My sample has a main window with a child user control created in ...