-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autoexport all types by interface by specific key #205
Comments
Can(How) I use interface IExportKeyedTypeAttribute? |
Tried this code and looks like it works...
|
Hi @mcdis I’ve been away for the weekend but I’ll take a look this evening and put something together. |
I feel that there are some excessive descriptions.
Or some extra method |
Hi @mcdis I hesitate to add an There is already a public static IExportTypeSetConfiguration ByKeyed<T>(this IExportTypeSetConfiguration configuration, Func<Type, object> keyFunc)
{
configuration.ByKeyedTypes(type =>
{
if (typeof(T).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
{
var key = keyFunc(type);
if(key != null)
{
return new[] { new Tuple<Type, object>(type, key) };
}
return null;
}
return null;
});
return configuration;
} |
Hi @ipjohnson, |
I'll look at putting this into a preview release in the next week. Did you want the extension |
I'm going to close this out as it will be released in 7.0 |
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:
The text was updated successfully, but these errors were encountered: