Skip to content
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

Question: Is there an attribute for [ExportNamed]? #318

Open
secovel opened this issue Jul 9, 2024 · 0 comments
Open

Question: Is there an attribute for [ExportNamed]? #318

secovel opened this issue Jul 9, 2024 · 0 comments

Comments

@secovel
Copy link

secovel commented Jul 9, 2024

Love your lib, been using it for YEARS.

I tried to use [ExportKeyedType] but I don't know the type before hand. I really need [ExportNamed].

If it doesn't exist how can I add it without having to resort to reflection scans of an assembly in order to manually register the classes?

I'm using the code to automatically register based on Attributes.

`
public static IInjectionScope GraceExportInstancesToContainer(this IInjectionScope scope, Assembly assemblyToExport = null)
{
scope.Configure(regbuilder =>
{
Assembly assembly;
if (assemblyToExport == null)
{
assembly = Assembly.GetEntryAssembly();
}
else
{
assembly = assemblyToExport;
}

           regbuilder.ExportAssembly(assembly).ExportAttributedTypes();

        });
        return scope;
    }

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant