Sure it can, but since you don't know the actual, closed type, your
factory will need to do some reflection to do it.
Hence I don't think you can do it in XML.
On 16/01/2012 6:49 PM, Intanda wrote:
Hi
Being new to both this forum and Castle I apologies in advance if the
following question has already been asked and answered
Based on the below contrived example can generic types, such as
TestGenericType, be created via instance factory methods when using
the Windsor Castle IoC framework? ( NB - Our current method of
component configuration relies on the XML based approach rather then
the fluent interface. )
//Example Generic Object
public class TestGenericObject<T, U>
{
public TestGenericObject()
{
}
private IList<T> someGenericList = new List<T>();
private IDictionary<string, U> someStringKeyedDictionary =
new Dictionary<string, U>();
public IList<T> SomeGenericList
{
//get; set; someGenericList
}
public IDictionary<string, U> SomeStringKeyedDictionary
{
//get; set someStringKeyedDictionary;
}
}
//Example Factory
public class TestGenericObjectFactory
{
public static TestGenericObject<V, W> StaticCreateInstance<V, W>()
{
return new TestGenericObject<V, W>();
}
}
Thanks in advance
--
You received this message because you are subscribed to the Google Groups "Castle
Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.