unity

Code Analysis warning CA2000: Call Dispose on object 'new ContainerControlledLifetimeManager()'

I'm getting a code analysis warning on some of my unit tests: WidgetManagerTests.cs (40): CA2000 : Microsoft.Reliability : In method 'WidgetManagerTests.TestInitialize()', call System.IDisposable.Dispose on object 'new ContainerControlledLifetimeManager()' before all references to it are out of scope. I'm using Unity ...

How to use Unity in order to implement a simple component publishing engine.

Dear ladies and sirs. In our project we have implemented a simple facility to let one party publish dynamic components and yet others - to consume them. I would like to phase out our in-house implementation and take something ready off the shelf. Since our UI guys already use Caliburn+Prism+Unity, I decided to go with Unity (having two ...

ASP.NET: dependency injection and roles

I have a page using an injected BLL service: a simple service returning a set of objects with a function like this: public IMyService { List<Foo> All(); } There is a default implementation for normal users. Now, i need that users in administrative role can view more objects, with another implementation of the service. Where can i con...

Unity 2.0 : Register an instance in config file

How to register an instance in congif file I am having this code UnityContainer.RegisterInstance<ICache>(new CacheMng(HttpRuntime.Cache)); And trying to have the equivalent in a config file <register type="ICache" mapTo="CacheMng"> <lifetime type="Singleton"/> <constructor> <param name="cache" type="Syste...

Silverlight: how to handle standard assemblies

A usual Silverlight task: to make the size of xap-file smaller. There are a lot of hot-to-do manuals that explain how to make your application modular. But I didn't find anyone that explains how to make "modular" standard libraries. The biggest part of my xap-file (1.7Mb, when overall size is 1.8Mb) is occupied by standard assemblies: a...

How to convert Untiy Configuration from 1.2.* to 2.0.*

In Unity 1.2, I had this text in web.config <type type="IRouteRegistry" mapTo="TownHall.Mvc.Routing.TownHallRoutes,TownHall.Mvc"> <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement,Microsoft.Practices.Unity.Configuration"> <constructor> <param name="routes" parame...

How can I get voice recognition features into the Unity Game Engine?

How can I get voice recognition features into the Unity Game Engine? Is there a plugin or a framework (hopefully freeware) that I could use? If so, any ideas on how to install it? Also, how much of a problem would there be with background noises in the game interfering with the voice inputs into the game? Are there any examples of games ...

Is there an RPG Dialogue plugin available for the Unity Game Engine?

Is there an RPG Dialogue plugin available for the Unity Game Engine? Or maybe an RPG starter kit? My Unity game needs a dialogue engine of some kind. I'd rather not have to make it from scratch if I can avoid it. ...

What should be injected as C'tor paramter under DI principles ?

I'm trying to understand which objects should be injected into an object and which should be created internally. If i have some List<int> (as data field) which holds infomation gathered during run time. it seems that i should init it in the c'tor instead of injecting it. but what about a hardware class which communicates through a CO...

Unity and Eager Singleton

Good morning, I would like to have an eager singleton in Unity, this singleton needs to be injected into so the RegisterInstance methods alone would not do it. The only other thing I can think of is in the configuration module have something like: container.RegisterType<Singletion, Singletion>(new ContainerControlledLigetimeManager(...

Are UDK and Unity suitable for a semester long group project by CS undergraduates?

For the past two years I've taught a final year undergraduate course in game development with the main focus being a project in groups of 4-5. I've required that the students use the NeoAxis engine mostly because it what I found accessible, and it comes with a good range of demo games that the students can "evolve" to become their own g...

using IObservable with unity

I want to use the iobservable pattern to expose a stream of events. The problem is that I'm using unity to create both the observer and the event generator. I would rather not have to new up both of these at application start just so I can start listening for events. Does any one have any suggestions about this? ...

Can I register my types in modules in Unity like I can in Autofac?

I am fairly familiar with Autofac and one feature that I really love about Autofac is the registering of modules. Does anyone know how I can do this with Unity? I'm having a hard time finding which terms to use in Google to come up with the unity equivalent if there is one. public class Global : HttpApplication, IContainerProviderAc...

Unity / EntLib: Injecting a dependency into a CustomTraceListener

Sorry, this is quite a special topic so this may not be of interest to many. :-( However, I need to do the following thing: I have an application that provides logging to some kind of console window (it's a WPF window, because of application requirements and because the application needs to look flashy even here - our special customer...

How can I inject a property only if the value is non-null at runtime using Unity?

Hi there, I have an interface to resolve and one of the mapped object's dependencies has a property on it which I would like to set with a value that I only have available when I resolve the top level object. There's no valid default value for the property. If its not set it should be null and it should only be set if the value that I ...

Is it possible to override parameter values when using Method Injection with Unity?

Hi there, It says in the Unity manual... ParameterOverride can be used only for constructors. So why are the parameters of methods left out? Cheers, Ian. ...

Unity 2.0 registering generic types via XML

I am trying to register a generic type in a config file for Unity 2.0 but can't seem to get it right. I have been referring to the MS documentation here : http://msdn.microsoft.com/en-us/library/ff660933%28v=PandP.20%29.aspx#_Generic_Types The code looks like this: public interface IRepository<T> where T : class { ... } public cl...

Intercepting child method calls using Unity

Using PIAB / Unity, is it possible to intercept "child" method calls ? e.g. the class has three methods ... DoSomething(), DoFirst(), DoSecond() The DoSomething() method calls DoFirst() which in turn calls DoSecond() I can get interception of DoSomething, but I can't get anything for DoFirst and DoSecond. I've tried various of the...

Unity 2.0 Interception and MethodInvocation.Arguments

On an asp.net mvc 2 app, I'm using Unity 2.0 interception app for various types of logging where every log entry requires the id of the current user. Currently I'm passing the User object as an argument to service and repository methods. The only reason I'm doing this is so that it's available on MethodInvocation.Argumants for the interc...

C# SerialPort.ReadExisting Error

Hi, I have hooked a Unity project up to an Arduino board via a com port. I am receiving data from it fine while using serialPort.ReadLine(), however, if i use serialPort.ReadExisting() I get the error: Object reference not set to an instance of an object I need to use ReadExisting as my application cant keep up with the rate that the A...