Skip to content

Attributes - is it possible to generate [AttributeName(ArgumentName = true)] #76

Description

@jeffward01

Hello!

Again, thank you for such an awesome library! It is my favorite!

I am writing some code to generate some classes which have some class properties with attributes from Sieve.

The attributes look like this:

public int Id { get; set; }

[Sieve(CanFilter = true, CanSort = true)]
public string Title { get; set; }

[Sieve(CanFilter = true, CanSort = true)]
public int LikeCount { get; set; }

[Sieve(CanFilter = true, CanSort = true)]
public int CommentCount { get; set; }

[Sieve(CanFilter = true, CanSort = true, Name = "created")]
public DateTimeOffset DateCreated { get; set; } = DateTimeOffset.UtcNow;

More specifically:

// This is how it looks in sieve
[Sieve(CanFilter = true, CanSort = true)]
public string Title { get; set; }

// This is what it would look like with the Testura.Code naming convention
[AttributeName(AttributeArgument = true)]
public string MyExample{ get; set; }

I know that this is possible with Testura.Code:

// This is implemented with the ValueArgument
[AttributeName(AttributeArgument: true)]
public string MyExample{ get; set; }

Note the ':' semi-colon sign. I am struggling to discover how to implement an '=' statement.
It would be great to use this Expression Statement generator as an IArgument, but I do not think it is possible due to:

  • Not convertable to IArgument
  • The MathExpressions do not allow for the = equals sign

Currently I am writing it with an ':', then later using a mystring.Replace(':', '='); in order to accomplish this. Is there a cleaner way of doing this?

Thanks so much!

I plan to add much to the Wiki! I have been compiling some notes and topics. Thanks!

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions