unity

Can I take advantage of Dependency Injection here?

Hi All, I'm working on a project that's using the MS Application Blocks. I see the 'Unity' dll is available to me. It's version 1.1 by the way. How can I use dependency injection here? I have a class public class ScheduleDataDetailsDC { public int ScheduleID; public List<ScheduleRateLineItem> MinRateList; public List<Schedu...

Configure Unity Injection for all descendants of some base class

How to configure Unity so that any class derived from some base class would go through injection pipeline defined for base class. public abstract class Base { public IDependency Dependency {get;set;} }; public class Derived1: Base { }; public class Derived2: Base { }; container.RegisterType<Base>(new InjectionProperty("Dependenc...

What's the meaning of ":" (colon symbol) on this Javascript code "var switchToTarget : Transform;" ?

Hello Guys, Just wondering what's the meaning of ":" (colon symbol) on this Javascript code below? var switchToTarget : Transform; Thanks, Gino ...

Using Microsoft.NET standard library types in Unity configuration file

I am trying to register a type conversion in my config file as follows: <param name="connectionString" parameterType="System.String"> <value value="MyDbConnection" type="System.Configuration.ConnectionStringSettings" typeConverter="ConnectionStringSettingsTypeConverter" /> </param> I am getting the standard can't...

measuring method execution time using Unity interception

Do you know a pattern for method execution time measurement using EntLib's Unity and its interception mechanism? ...

Disposing scopedregionmanager

Hi I am having some dificulties regarding my application design. I have a module that is resposible for creating scopedregionmanagers based on the outside xaml in which i define regions. When I inject those outside xaml-s i create scoped regionmanagers and then i register them in the container: detailregionmanager = regionmanager1.Regio...

Conditional logic on Generic Type Constraints

I'm trying to write an automocking extension of Unity. While it would be much easier to use a Windsor subdependency resolver and RhinoMocks I'm forced by the business to use Unity and Moq. I haven't found an existing solution that uses Moq and I've found out why. Moq can't generate mocks from just a Type parameter, which makes Unity ex...

How to Register and resolve objects using rules in Microsoft Unity

Hi, I have a scenario where I have multiple classes implementing one interface. When at runtime the resolution is done I want some rules to execute to give me back the required instance. I am thinking of writing some extension for Unity which can accept the configurations like this: <unity xmlns="http://schemas.microsoft.com/practices/...

Unity 2.0: How to create child containers on CTor injection?

Hello, I have a MessageSender class that its constructor looks like this: public MessageSender(IInputComponent input, IOutputComponent output) { m_Input = input; m_Output = output; } This is how I instantiate it: Container.RegisterType<IMessageSender, MessageSender>(); Container.RegisterType<IInpu...

Safe Unity Builds.

I work on a large C++ project which makes use of Unity builds. For those unfamiliar with the practice, Unity builds #include multiple related C++ implementation files into one large translation unit which is then compiled as one. This saves recompiling headers, reduces link times, improves executable size/performance by bring more func...

Unity Register type mapping if missing?

This is similar to This question but the answer doesn't solve my problem. I want to register a default implementation for an interface in code but be able to override that in a config that is read BEFORE the code is run. I want to do something like if (!container.IsImplementationRegistered(typeof(TInterface)) { container.RegisterTy...

Unity 2 and Silverlight 4

I am using Unity 2.0 with Silverlight 4 and RIA Services. Is xml configuration not supported in the web project of a Silverlight Business Application? The only way I can get the resolve method of the container to work is if I register my types at runtime vs design time in the xml config file. ...

Unity: pass parameters to custom lifetime constructor, in xml configuration file

I wrote my CustomLifetimeManager like this: public class CustomLifetimeManager <T> : LifetimeManager { private readonly string _arg; public CustomLifetimeManager(string arg) { _arg = arg; } } Now, it works easy configuring the container programmatically, but how add it in configuration file like the following? ...

Custom lifetime management in DI containers (wcf proxy: Unity vs Castle Windsor)

Hello, I've found nice post: Singleton WCF Proxy. It is about the implementation of WCF proxy life scope using Castle Windsor DI container. Implementation of the abstract class AbstractLifestyleManager from Castle.MicroKernel.Lifestyle namespace overrides 3 methods: Resolve, Dispose and Release. In the Release method we have access ...

Unity Child Container Lifetime with WCF

We're using Unity to provide dependency injection within the WCF service layer for our current project, and we have followed examples such as the following to write a service host factory, service host, service behaviour and instance provider: http://avingtonsolutions.com/blog/post/2008/08/02/Uisng-Unity-with-a-WCF-Service.aspx The sol...

Unity 3D: code help (javascript)

Hello all; I'll get right to the point... I would like to display text and have a GUI option for leaving the scene once you collect 5 *wood. If you chose NOT to leave the scene than I would like it to disable the script "Timer" (Tagged 'Timer', In the Hierarchy its called 'Timer'). If you chose TO leave than I would like it to call the ...

How do I register type with Unity where constructor parameter is HttpSessionStateBase?

I've got interface IImportManager with SessionImportManager that implements this interface. SessionImportManager's constructor must be passed an instance of HttpSessionStateBase in order to work properly. How should I register IImportManager with Unity? I've tried _unityContainer.RegisterInstance<IImportManager>(new SessionImportManag...

Unity 2.0: How does it work?

Hello, I'm using Unity and would love to read a good explanation about its internal works - mostly how it builds up objects. I am aware of this nice MSDN article - Getting to Know the Unity Application Block, and it has a great drawing of the proccess, but I'm looking for a more technical and detailed explanation. Can anyone direct me...

Do I need to download the Unity source code in order to use it?

I looked unsuccessfully for a link for binary downloads for Unity. Is the only option to download the source code from Codeplex and build it myself? ...

What are the basic principles of designing under Dependency Injection pattern

hi all, I'm new to the all DI pattern idea and i have some basic design doubts. im using Unity application blocks 2.0 as my DI framwork. To the questions : Say I have an interface for HW devices named IDevice. And some HW listener that receives such IDevice. Now say you have several HW Devices that implement IDevice and Several Liste...