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

Support for System.Composition.MetadataAttribute #12

Open
Zaneo opened this issue Nov 24, 2021 · 1 comment
Open

Support for System.Composition.MetadataAttribute #12

Zaneo opened this issue Nov 24, 2021 · 1 comment

Comments

@Zaneo
Copy link

Zaneo commented Nov 24, 2021

Problem Statement

It’s very difficult to use MetadataAttributeFiltering in Unity netstandard2.0. System.ComponentModel.Composition is unavailable.

Desired Solution

I would like to be able to tag classes with System.Composition.MetadataAttribute.

Alternatives You've Considered

I have tried to load the nugget package System.ComponentModel.Composition but Unity shims it and the project never gets the reference.

I have tried tagging with System.Composition.MetadataAttribute but the Registrations on the container does not show any MetadataAttribute

Additional Context

It’s Unity so the netstandard2.0 support is kind of iffy.

@tillig tillig changed the title Support for System.Composting.MetadataAttribute Support for System.Composition.MetadataAttribute Nov 24, 2021
@tillig
Copy link
Member

tillig commented Nov 24, 2021

I think this may be just slightly more involved than adding support for a second attribute. The reason is that, while this particular integration does query using System.ComponentModel.Composition.MetadataAttribute, we also tie into the Autofac.Mef package which assumes System.ComponentModel.Composition is available.

What I'd want to avoid in a fix for this is someone getting in a position where some ways to register metadata support both attributes but some ways only support one attribute, thus making a confusing support issue.

I have not dived in to do deep research on this. It may be a non-issue, but figuring that out will be part of solving this. Before we take any sort of PR for it, I'd want to hear about why no change is required in Autofac.Mef. If there are changes required in Autofac.Mef, likely we'd want to do those first so we can take the updated version here and ensure consumers of Autofac.Extras.AttributeMetadata get a unified experience on install.

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

No branches or pull requests

2 participants