Hi all,
I have been using Unity for quite a while but I have always used it with constructor injection. In an effort to reduce the number of classes I have to inject into my view models (as my commands rely on them) I thought I would try creating a concept that uses Property Injection and thus quash the requirement for the large constru...
Hi All,
public partial class HTCmds : ResourceDictionary
{
private ICanvasService mCanvasService;
[Dependency]
public ICanvasService CanvasService
{
get { return mCanvasService; }
set { mCanvasService = value; }
}
public HTCmds()
{
CopyComm...
I had this awesome idea... but I am afraid maybe it is actually a bad idea....
we use unity for dependency injection.
I make interfaces from my web services using partial classes for the purpose of mocking and web services....
What I want to do is put my web services into unity and get them via dependency injection...
What do you thi...
hii
How to bring a ball bouncing effect on different surfaces like wood, water,mud sand, and metal.
In unity, i tried it by using bouncy material.In all surfaces the ball bouncing effect is same. I dont know how to differentiate the surfaces
...
Hi,
we want to use Unity for IOC.
All i've seen is the implementation that there is one global static service (let's call it the the IOCService) which holds a reference to the Unity container, which registers all interface/class combinations and every class asks that object: give me an implementation for Ithis or IThat.
Frequently i se...
I have a facade in a library that exposes some complex functionality through a simple interface. My question is how do I do dependency injection for the internal types used in the facade. Let's say my C# library code looks like -
public class XYZfacade:IFacade
{
[Dependency]
internal IType1 type1
{
get;
set;
...
Hi everybody!
In a new WPF project (VS2010) i 'm using Unity 2 for the first time.
In this project i use the following structure:
Solution
WPF Project
Class Library1
Class Library2
Class Library 3 ....
Registering the different types using Unity is done in WPF Project using the following snippet:
IUnityContainer container = new Un...
While trying to learn Unity, I keep seeing the following code for overriding GetControllerInstance in MVC:
if(!typeof(IController).IsAssignableFrom(controllerType)) { ... }
this seems to me a pretty convoluted way of basically writing
if(controllerType is IController) { ... }
I appreciate there are subtle differences between is and...
I want to use unity (2.0) to resolve my dependencies in a way so that i can configure policy injection (policies, matching rules and call handlers) in the .config file.
Or an other way to put it; i want my resolved objects to be "policy enabled", so that i can add and change to policies in config without have to recompile.
Any ideas on...
I am looking for a formula that will give me all of the Vector2 Points within a certain radius given the center.
Essentially what I am trying to do is change the color of each pixel in a 256 x 256 texture that is within a certain radius from a specific pixel (Using the Unity3d Game Engine). Programming Language doesn't really matter, ...
If RPG with the ability to change armors and clothes are made, how is it done?
I mean the 3d side mostly
If i make normal character, that has flat clothes, it would be easy, just change textures, but question is about armors, which have totally different models.
So are only armor models recreated or character model with armor?
How is i...
I am using Unity 2.0 as my IOC container and I have created a LifeTimeManger for remote types very similar to what is describe in this thread.
I have also implemented a IUnityContainer decorator for my client side container that attaches a policy injection interceptor for any types that have policies. The relevant code in the decorat...
This is driving me nuts...
Two assemblies/projects in play:
An Infrastructure project, which has an interface in it:
IDtoMapping<in TDto, out TDomain>
And an app project, referencing Infx, with an implementation:
PatientMapping : IPatientMapping
...and a marker interface, just to be clear:
public interface IPatientMappin...
Hey,
I'm trying to implement my own interception while still using the Unity container. I want to do this in such a way where it respects the lifetime manager used. i.e. if it is a PerResolveLifetimeManager then I want to have wrap the instance once and I want that wrapped instance to be used throughout the resolve.
So far I implem...
This error occurred in Unity 2.6 on Windows after some exception was thrown from a script,
but does not always happen.
Do you know when the error occur?
...
Hi,
I've just started an MVC 2.0 solution using Unity 2.0. I thought it would be a good idea to create my Unity Container with all the RegisterType calls within a separate assembly to allow me to reuse it throughout my Unit Tests. However, I quickly realised I'd end up with circular references regardless of unit testing. My MVC appli...
Hi,
i want to add an existing object to my unity container registered to a specific interface,
so when i resolve the interface i get that existing object (it's used for testing, and the object holds a lot of XML data, and for eacht test case i want to use another object).
I do it like this:
public static void RegisterInstance<T>(T in...
The application I'm working on requires objects to be created on the fly, some of them also use singleton instances (lifetime manager based, of course), because there is state involved (think WCF service sessions, etc...).
As long as I resolve via the same instance of the UnityContainer class, everything is fine, but I think here the sn...
I'm trying to find the best approach to build a music visualizer to run in a browser over the web. Unity3D is an option, but I'll need to build a custom audio import/analysis plugin to get the end user's sound output. Quartz does what I need but only runs on Mac/Safari. WebGL seems not ready. Raphael is mainly 2D, and there's still the i...
Does anyone knows how to workaround the fact Unity Container InjectionConstructor does not have any overload for Func<string>?
this.unityContainer
.RegisterType<IService1Client, Service1Client>()
.Configure<InjectedMembers>()
.ConfigureInjectionFor<Service1Client>(new
InjectionConstructor(() =>
this.unityContain...