Skip to content

Export attributes should only be allowed on class #261

Closed

Description

@jods4

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.

Activity

  1. ipjohnson commented on May 26, 2020

    @ipjohnson
    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.

  2. jods4 commented on May 27, 2020

    @jods4
    CollaboratorAuthor

    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.

  3. ipjohnson commented on May 27, 2020

    @ipjohnson
    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.

  4. ipjohnson commented on Jul 12, 2020

    @ipjohnson
    Owner

    I'm going to close this as completed

  5. jods4 commented on May 18, 2021

    @jods4
    CollaboratorAuthor

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions