There is no default support of IEnumerable.
There is no default support of IEnumerable dependency for Unity configuration. The only alternative using the existing unity configuration to achieve your target is as to map a IEnumerable to T, as follows. C# code is: IUnityContainer container = new UnityContainer(); container.
LoadConfiguration(); IThing thing = container.Resolve(); Console. WriteLine(thing. Value); If you do not want this way, I think you can extend Unity Configuration System to support IEnumerable dependency resolving, by implementing a new EnumerableElement inherit ParameterValueElement.
You can add support for IEnumerable, ICollection and IList via a container extension that can be found in the TecX project. The source code for the CollectionResolutionExtension is located inside TecX. Unity project.
– Sebastian Weber 2 days ago Sounds very good, thanks for sharing :) – Ethan Woo 2 days ago By changing the definition of ThingArray to SimpleThing I managed to get the example working and inject an empty array, but how can I define EnumerableThing to contain four SimpleThing? – batwad 2 days ago.
Here's one solution that I've found, but it's a bit naff. You need a wrapper class to help Unity recognise that an array is IEnumerable. Public class ArrayWrapper : IEnumerable { public ArrayWrapper(T things) { this.
Things = things; } private IEnumerable things; IEnumerator IEnumerable.GetEnumerator() { return this.things.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return this.things.GetEnumerator(); } } You can then configure Unity to inject one of these, using Ethan's EnumberableThing idea. Like I say though, a bit naff and awkward when you want another CompositeThing with three, five, six things etc. Surely Unity should be able to recognise that an array is IEnumberable and inject it?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.