Hi!
Can you help me with this scenario...
I want to scan all types in specific assembly and export all types which impl specific interface...but I want to export by key which defined thru attribute. And I want to export with the specific lifestyle.
[Foo("a")]
class A: IExportInterface {}
[Foo("b")]
class B: IExportInterface {}
// ... after apply some grace magick ...
container.Locate<IExportInterface>(withKey: "a") // Yeah, It`a instance of A
container.Locate<IExportInterface>(withKey: "b") // Yeah, It`a instance of B
Some optimize and degree of freedom requirements:
- export types only from specific assembly;
- key provider delegate:
string ResolveKey(Type _type)
ExportAssemblyContaining?
I can suggest some export method like:
_.ExportAssemblyContaining<IHofChangeProcessor>().ByKey(_type=>_type.GetTypeInfo().GetCustomAttribute<FooAttribute>().Name).Lifestyle.Singleton();
_.ExportAssemblyContaining<IHofChangeProcessor>(typeof(Anchor).Assembly).ByKey(_type=>_type.GetTypeInfo().GetCustomAttribute<FooAttribute>().Name).Lifestyle.Singleton();
Hi!
Can you help me with this scenario...
I want to scan all types in specific assembly and export all types which impl specific interface...but I want to export by key which defined thru attribute. And I want to export with the specific lifestyle.
Some optimize and degree of freedom requirements:
string ResolveKey(Type _type)ExportAssemblyContaining?
I can suggest some export method like: