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

Export attributes should only be allowed on class #261

Closed
jods4 opened this issue May 26, 2020 · 5 comments
Closed

Export attributes should only be allowed on class #261

jods4 opened this issue May 26, 2020 · 5 comments
Labels

Comments

@jods4
Copy link
Collaborator

jods4 commented May 26, 2020

I wanted to export some instances with attributes, so I was pleasantly surprised that ExportAttribute can be put on a property.

Some research later, I find nothing in Grace code that looks at export attributes on anything else than a class, so their attribute target should probably be changed.

@ipjohnson
Copy link
Owner

Were you looking to do an export of a property? In older version of Grace I supported it but dropped it a while back because it didn't seem like a useful feature. Then again attributes went out of vogue for a while when Fluent was all the rage.

@jods4
Copy link
Collaborator Author

jods4 commented May 27, 2020

Personally I like attributes. I don't like having a central point where tens if not hundreds of exports are declared. Attributes keep the information local to where the code is and avoid merge conflicts.

I was looking to export specific instances (singletons) but it's not a key case and wouldn't say it's a very useful feature.

I was thrown-off by the contradiction that the attributes describe themselves as meaningful on properties and methods, but actually don't work. If they could target classes only I wouldn't have lost some time trying to make them work.

@ipjohnson
Copy link
Owner

Yeah it is interesting how fluent registrations became so popular because registering hundreds (we have 500+) by hand sounds horrible. I usually just export a whole assembly by interface and apply lifestyles based on naming convention and patch any missing piece with fluent registration (there isn't usually much).

I'll make the change to the attribute usage to clear up any confusion. Sorry for the inconvenience.

@ipjohnson
Copy link
Owner

I'm going to close this as completed

@jods4
Copy link
Collaborator Author

jods4 commented May 18, 2021

@ipjohnson sorry to necro that old issue, but I do have a related question:

I have cases where some of my assemblies has to export from a factory method.
Is there a way to achieve this with attributes and automatic discovery?

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

No branches or pull requests

2 participants