About Configuration file of Generic type

Jan 6, 2010 at 7:58 AM

Hi Guys.

I am using Unity 1.2 and I am trying config some Generic type in .config file.

the types  like this

Interface IClass<T>

{
       T Foo();


}
class ClassT: IClass<T>
{
     T Foo(){};
}
class ClassString: IClass<String> { String Foo(){}; } class ClassInt: IClass<Int> { IntFoo(){}; }

I know a way  resolve  ClassT


 <type type="IClass`1"   mapTo="TestApp.ClassT`1, TestApp">

            <!-- Will be configured as singleton by the lifetime 

                manager above -->

            <lifetime type="singleton" />

          </type>

but  I want  a different way. like this

Container.Reslove<IClass<string>>()   // <---this is ClassString
Container.Reslove<IClass<int>>()   // <---this is ClassInt

can i register ClassString & ClassInt by config?  how?

This is my first post here , thanks for your time.

 

Jan 6, 2010 at 11:01 AM
Edited Jan 6, 2010 at 11:13 AM

Refer to thread - http://unity.codeplex.com/Thread/View.aspx?ThreadId=56052

 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com