Configure container in Bootstrapper with Unity
-
I was trying to learn Unity and followed Sashas article Attached VM Behaviours[^] but he defines the Container like so:
public class Bootstrapper : UnityBootstrapper { ... protected override void ConfigureContainer() { base.ConfigureContainer(); //windows Container.RegisterType(new ContainerControlledLifetimeManager()); ... } }
But when I try and register the shellwindow it tells me that the Container does not exist. I assumed they changed something so my question is if you are not supposed to use the Bootstrapper container at all? I can register types with the code:
protected override void ConfigureContainer() { IUnityContainer container = new UnityContainer(); //windows container.RegisterType(new ContainerControlledLifetimeManager()); base.ConfigureContainer(); }
But then how do I call Resolve without declaring a property IUnityContainer? [Edit] I get the error message:
Quote:
Could not load file or assembly 'Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f' or one of its dependencies. The system cannot find the file specified.
All I could find out was this: c# - How to resolve "Could not load file or assembly 'Microsoft.Practices.Prism' " error? - Stack Overflow[^] but it did not solve my problem. [/Edit]
-
I was trying to learn Unity and followed Sashas article Attached VM Behaviours[^] but he defines the Container like so:
public class Bootstrapper : UnityBootstrapper { ... protected override void ConfigureContainer() { base.ConfigureContainer(); //windows Container.RegisterType(new ContainerControlledLifetimeManager()); ... } }
But when I try and register the shellwindow it tells me that the Container does not exist. I assumed they changed something so my question is if you are not supposed to use the Bootstrapper container at all? I can register types with the code:
protected override void ConfigureContainer() { IUnityContainer container = new UnityContainer(); //windows container.RegisterType(new ContainerControlledLifetimeManager()); base.ConfigureContainer(); }
But then how do I call Resolve without declaring a property IUnityContainer? [Edit] I get the error message:
Quote:
Could not load file or assembly 'Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f' or one of its dependencies. The system cannot find the file specified.
All I could find out was this: c# - How to resolve "Could not load file or assembly 'Microsoft.Practices.Prism' " error? - Stack Overflow[^] but it did not solve my problem. [/Edit]
Post your question on the article itself - you are much more likely to get an answer there than here
========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================
-
Post your question on the article itself - you are much more likely to get an answer there than here
========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================
Thing is that it should be a general question. I assumed lots of people had the same issue.
-
I was trying to learn Unity and followed Sashas article Attached VM Behaviours[^] but he defines the Container like so:
public class Bootstrapper : UnityBootstrapper { ... protected override void ConfigureContainer() { base.ConfigureContainer(); //windows Container.RegisterType(new ContainerControlledLifetimeManager()); ... } }
But when I try and register the shellwindow it tells me that the Container does not exist. I assumed they changed something so my question is if you are not supposed to use the Bootstrapper container at all? I can register types with the code:
protected override void ConfigureContainer() { IUnityContainer container = new UnityContainer(); //windows container.RegisterType(new ContainerControlledLifetimeManager()); base.ConfigureContainer(); }
But then how do I call Resolve without declaring a property IUnityContainer? [Edit] I get the error message:
Quote:
Could not load file or assembly 'Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f' or one of its dependencies. The system cannot find the file specified.
All I could find out was this: c# - How to resolve "Could not load file or assembly 'Microsoft.Practices.Prism' " error? - Stack Overflow[^] but it did not solve my problem. [/Edit]
Hrmf.. Started a new project, uploaded all dependencies again, and now everything is working as it should :|