ipjohnson / Grace

Grace is a feature rich dependency injection container library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Export an unrelated type with an attribute

jods4 opened this issue · comments

commented

I have a bit of a weird use-case: I am interested in exporting a type that's related, but not the same, as an attributed type.

Basically I would like to have the following code:

[MagicExport]
class C { }

and that would actually register Register<C> as an export for IRegister.

It seems you were going into that direction at one point with IExportStrategyProviderAttribute, which seems to be an attribute that provides a complete -- so possibly unrelated to attributed type -- export strategy.

Unfortunately for me, that interface is never referenced in Grace code.

Hi @jods4

I've pushed a new version to nuget. If you look at the changeset I added a test similar to the situation you described. Let me know how it works.

commented

That looks perfect, and it was so quick... as always!
You're the best, thanks.

Do you have a planned release date for 7.2.1 final?

I'll look at pushing it this weekend, as I need to look at rolling out support for .net 6 and a new DI feature.

This has been released