unity

How should the web.config look like in Unity Dependency Injection for WCF services?

I am creating new instnace provider which resolve services through Unity. I am not sure how to add the configuration in web.config. Following is my service class. public class Service : IService { private IUnitOfWork _unitOfWork; private IMyRepository _myRepository; // Dependency Injection enabled constructors public Service(I...

Implement iphone MSAA using Unity build

I want to implement MSAA into the Unity build of a game. Currently I am using this code I got from the Unity forums and it compiles but I can clearly see that it is having no effect in game. Any help would be appreciated. bool msaaEnabled = false; CGSize globalSize; struct MyEAGLSurface { GLuint format; GLuint depth...

Accessing unity container in view model class

I have a shell which looks like toolbar and defines my main region (a wrap panel). What I need to do is be able to add widgets to the shell and when a widget is clicked, a new window (view) is opened. Below is what I have so far: I created a module class which adds a view to the main region: public class MyModule : IModule { protec...

NServiceBus with Unity 2.0?

Anyone using NServiceBus 2.0 successfully with Unity 2.0? I've tried to compile sources of NServiceBus.ObjectBuilder.Unity.dll against Unity 2.0 assemblies but got several compile-time errors because of changed/deleted signatures of many object methods in new Unity. In the documentation Udi Dahan says that attaching any container is a...

DataServiceContext in WPF ViewModels

Hi, So I have a WPF application accessing entities through WCF Data Services. At the moment, I am accessing the proxy class that implements the DataServiceContext directly in my ViewModel. For example: this.context = new MyOwnDataServiceContext(new Uri("http://localhost/myowndataservice")); I then populate entities on the ViewModel f...

Microsoft Unity- Issue With Resolve

Hello, I am looking to do this: container.Resolve(); When it does this, its going to inject a IDependency into the underlying entity object. However, the dependency stored within the container requires an object of type DependencyValue, which is supplied a value from a DependencyFactory. So long story short, the issue I'm having is ...

How to maintain a Unity container reference in WCF

I'm configuring validation application block from Enterprise Library 5 to use validation rules from the web.config file over a WCF call. The problem is as new calls to the WCF service occur, validation application block is spending a considerable amount of time reading the validation configuration before validating. So my first call to...

Resolving dependencies in filters in MVC2

I'm using Unity as a IoC container in my MVC2 project, and I was wondering if there was a way to resolve property dependencies inside my filters from a class that extends the DefaultControllerFactory (I've resolved all of the dependencies in my controllers this way). I know I can resolve them by extending the ControllerActionInvoker, and...

Unity auto-factory with params

I'm trying to figure out the correct way to inject an auto-factory which takes params, or even if this is possible with Unity. For example I know I can do this: public class TestLog { private Func<ILog> logFactory; public TestLog(Func<ILog> logFactory) { this.logFactory = logFactory; } public ILog C...

Does unity just make clasess with out needing anything registered?

I am watching Mike Tautly's awesome intro to Prism. It was all making sense, but I got a bit confused in the sixth video. He has his view class's constructor take a parameter of the ViewModel. He then says that unity will fill this in for us (ie construct it). In the past he has had to register this kind of thing (ie IMyClass registe...

How should I implement an MVC Bootstrapper for Unity and AutoMapper?

What is the best way to create a bootstrapper for my MVC 2 app? I'm using Unity and AutoMapper and want to abstract the loading and configuration of them as much as possible. A decent example is here (http://weblogs.asp.net/rashid/archive/2009/02/17/use-bootstrapper-in-your-asp-net-mvc-application-and-reduce-code-smell.aspx ), but Unit...

Alternative to TheDefault and ConstructedBy methods in Unity

Basically what i'd like to do is injecting what's in HttpContext.Current.User everytime I ask for an IPrincipal. This is the code in StructureMap: ForRequestedType<IPrincipal>() .CacheBy(InstanceScope.Hybrid) .TheDefault.Is.ConstructedBy(ctx => HttpContext.Current.User) How do I achieve the same in Unity?. ...

Unity Static Factory Extension

I can't seem to find Microsoft.Practices.Unity.StaticFactory.dll anywhere. Is there another way of registering a static factory? Looking for something like this container.RegisterFactory(()=> FooFactory.CreateFoo()); ...

Running Different version of Unity.

Is it possible to run different versions of Unity within an app? I m referencing an app which uses an old version of unity and the current version of unity i m using the newest version. I get this warning . I tried what the posts suggested but didnt work out. How to get this working? THanks. ...

Unity Container Memory Leaks

Hi I´m working on a project that uses Enterprice Libraries´s Unity container to resolve dependencies for exception handling, cache, logging and db access but we keep getting a lot of leaked objects into memory. We are using property injection like this: [Dependency] public Database DB { get { return db; } set { db = value; } } [De...

Unity Configuration using multiple config files

Is there a way to configure a container in multiple configuration files? For instance, I want to register types for a container in a web.config file located at the root and also register types for the same container (and others containers) in the web.config file of sub-folders. And also register other types for others containers in a...

UnityContainer usage and best practices

Hello, Is it wrong to use UnityContainer in an app to access references to objects from different parts of the application (but the same assembly)? The application (WPF) has several regions that need to access each other and I have used UnityContainer to do that. For example, the "main" region (which is a drawing area) has a presenter...

Blender vs. Unity

I want to make a 3D game, preferably that can be played in browser. Some people say blender, some say unity. What are the pros and cons of each? Which one do you prefer? Why? Also, do you have any suggestions for tutorials? ...

ASP.NET MVC inject per request

I need to inject EF context per request. Is there any way to implement it? ...

Resolving a type without registering first - prism 4 and Untiy

First of all I would like to remark I am new with the concept of prism, DI and containers. I am looking on one of the code samples provided with the Prism Library: The code simply injects a view with the "Hello World" string (in a TextBlock element) to a region in the shell. When the application starts-up, it creates a new BootStrapper ...