unity

How can I loosely reference modules in Prism so they can or cannot exist?

In this stackoverflow question I learned that Prism/Unity is not as decoupled as I thought, e.g. if I have this class which gets menuManager injected into its constructor, then I have to make sure that this class actually exists somewhere (I thought that you could just pull the .dll that contains the class and the container would deal wi...

What is the difference between Prism's IContainer and IUnityContainer?

I've got a Prism project with code that I've gotten from various sources, everything is working quite nicely, but I noticed that in some modules I inject IContainer container and in other modules I inject IUnityContainer container IContainer only seems to have Components, Add, and Remove while IUnityContainer has dozens of methods...

Windsor-like Xml configuration <include> in Unity

Hello, I have common DI configuration for my application and integration tests. However, a couple of the dependencies do differ; e.g. my IEMailGateway in the integration tests uses a decorated version so that 'real' e-mails are not sent. In Windsor I would have the 'main' configuration xml file and simply add an include to add the var...

How do I set a Guid using Microsoft Unity

I don't get it. I can't find any docs on this seemingly innocuous problem. I have tried 4 different formats: 1) brace+lower <property name="DefaultImpactID" propertyType="System.Guid"> <value value="{fbfa75c0-a0a0-40e2-a239-c5c6b7435fa6}"/> </property> 2) brace+upper <property name="DefaultImpactID" p...

How do I do this in Unity?

Jimmy Bogart has an article on using Automapper with an IoC container. He has an example using StructureMap but I am using Unity and I'm not sure how to use an InjectionConstructor properly. Below is the code from the Article and below that is my poor attempt. Can anyone tell me how to do this properly? public class ConfigurationRegis...

Why does my Moq IEventAggregator verification fail?

I use Composite WPF(Prism) and I am trying to unit test that my Controller does in fact subscribe to a Composite Event. My subscription code looks as follows... //Init Events. this.eventAggregator.GetEvent<PlantTreeNodeSelectedEvent>().Subscribe( ShowNodeDetails, ThreadOption.UIThread); My unit testing code looks as follows (I us...

How can I have Prism/Unity automatically resolve a View (UserControl)?

In a Composite Application (Prism), when my module loads, I get this error: {"The current build operation (build key Build Key[CustomersModul.ViewModels.CustomerAllViewModel, null]) failed: The parameter view could not be resolved when attempting to call constructor CustomersModul.ViewModels.CustomerAllViewModel(Customers...

Does Prism/Unity have a "service preloader"?

I've got a number of modules in a Prism application which load data that takes 3-8 seconds to get from a service. I would like to be able to say in my bootstrapper something like this: PSEUDO-CODE: Customers allCustomers = Preloader(Models.GetAllCustomers); And this would run in a background thread and when the user actually needs t...

Can I use Ninject for Prism event aggregation in Silverlight?

I'm looking into doing a project in Silverlight 3 using Prism and I really like the eventing aggregation as shown here http://development-guides.silverbaylabs.org/Video/Prism-Eventing All the resources seem to be pointing to using Unity with Prism and not Ninject. In Ninject is there a similar way of aggregating events? Or if I want to ...

Getting Started with Unity Framework

Could anyone recommend some good resources for getting started with the Unity framework? I've downloaded the source from Codeplex and got it to compile. So now I've got a set of compiled binaries, where do I go next? I understand the principles of inversion of control but don't have much knowledge of the specifics of the Unity framework....

How to send a parameter to an object's constructor with Unity's Resolve<>() method?

Using Unity in Prism, I would like to send a parameter to the object's constructor like this: PSEUDO-CODE: SmartFormPresenter smartFormPresenter1 = this.container.Resolve<SmartFormPresenter(customer)>(); But instead I have to instatiate it and then assign a property: SmartFormPresenter smartFormPresenter1 = this.container.Re...

.NET IoC - Equivalent Code for .NET Unity

In this Autofac IoC article they show an example of mapping an interface to an implementation with a parameter. You'll find it halfway down the article. What is the Unity equivalent in XML? Can't use the fluent syntax for what I'm doing. Needs to be an external config file. UPDATE: This is the specific piece of code I want to know how ...

The Easiest way to learn Unity

Guys, is there an easiest way to learn unity ? I haven't read much about IoC etc, but I need to learn IoC based on Unity for my future reference. Please help. Thanks ...

Ninject equivalent of Unity RegisterInstance method

Does Ninject have and equivalent method for unity's registerinstance. I want to create a mock object and register it. Thanks ...

Unity Resolve performance on ASP.NET application

I'm looking at using unity to resolve some interfaces but am not sure about it's performance in terms of scalability. I've registered my dependency types in the web.config and then have this code for a MVP type approach which takes the current web page as the view (IView) in the constructor of the presenter. The code below is taken from ...

MEF vs. any IoC

Looking at Microsoft's Managed Extensibility Framework (MEF) and various IoC containers (such as Unity), I am failing to see when to use one type of solution over the other. More specifically, it seems like MEF handles most IoC type patterns and that an IoC container like Unity would not be as necessary. Ideally, I would like to see a ...

.Net RIA Services: DomainService Needs a Parameterless Constructor?

I'm using the July CTP of .Net RIA Services in an ASP.Net application with some Silverlight components. I'm calling the RIA Services from Silverlight. My problem arose when I tried to use Unity and constructor dependency injection in my Domain Service (a LinqToEntitiesDomainService object). The Silverlight application now complains ab...

ASP.NET MVC and Unity 1.2 Container question.

I am trying to use the Unity container to make it easier to unit test my controllers. My controller uses a constructor that accepts an interface to a Repository. In the global.asax file, I instantiate a UnityContainerFactory and register it with the MVC framework and then register the repository and its implementation. I added the [Depen...

again about log4net and Unity IOC config

Hello, I've bumped through a few of these questions laying around various sites and the answers seem to be spun by l4n officianados toward the value of the lightweight wrapper that log4net 'is' (don't you get it?) and similar points of mind-boggling fact. However it seems that what users are asking for (and this is my question) is how ...

linq2sql using with dependency injection?

Hi Does anyone know how to have dependency injection work with linq2sql. Heres my situation.. I will explain it as best i can here. I have a base class which has a DBML (linq2sql) and classes etc .. This DBML is COMMON to more than 1 project.. Well each project has its own DBML but has all the tables etc that is in the common dbml i a...