Skip to content

Feature request: publicly expose AttrAttribute.PropertyInfo getter #650

@bart-degreed

Description

@bart-degreed

Description

The resource graph builder performs traversal of relations to resolve the matching PropertyInfo instance for filters like ?filter[user.id]=1. It follows the resource.User property and points to its .Id property. I need access to that property in order to implement deep searching using Elasticsearch. Aside from the duplication, it does not seem easy/possible to re-implement that myself.

Furthermore, once this is exposed, it looks like InternalAttributeName can be removed. Which is a good thing, according to this documentation:

        /// <summary>
        /// Do not use this overload in your applications.
        /// Provides a method for instantiating instances of `AttrAttribute` and specifying
        /// the internal property name.
        /// The primary intent for this was to enable certain types of unit tests to be possible.
        /// This overload will be deprecated and removed in future releases and an alternative
        /// for unit tests will be provided.
        /// </summary>
        public AttrAttribute(string publicName, string internalName, bool isImmutable = false)
        {
            PublicAttributeName = publicName;
            InternalAttributeName = internalName;
            IsImmutable = isImmutable;
        }

Existing unit tests can then use .PropertyInfo.Name instead.

Please let me know if there are any objections to this. I'd be happy to submit a PR once approved.

Environment

latest master branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions