Rename dto property using autoquery

Hi,

i’m using autoquery and are quering against a subentity.
It works fine but i want to change the naming of the DTO Property.
How can i do that?

The property called BookingResourceRelationResourceIds refers to the subentity BookingResourceRelation.ResourceId but i want to call the property

BookedResourceIds instead.

How can i do that?

  [Route("/bookings",
    Summary = "Find booked events for currently logged in user",
    Notes =
        "This service is used to get bookings for the current user, the result will be paged if the query returns a to large set of values.",
    Verbs = "GET")]
[ApiResponse(HttpStatusCode.Unauthorized, "You were unauthorized to call this service")]
[Authenticate]
public class BookingQuery : QueryDb<Booking, BookingQueryResponse>, IJoin<Booking, BookingResourceRelation> 
{

    [ApiMember(
    Description =
        "Query for specific Booked Resources, default is all resources",
    ParameterType = "query",
    IsRequired = false)]
    //[QueryDbField(Field = "BookingResourceRelationResourceIds")]
    public int[] BookingResourceRelationResourceIds { get; set; }

You can rename a field using an alias, e.g:

[DataContract]
public class BookingQuery 
{
     [DataMember(Name="BookedResourceIds")]
     public int[] BookingResourceRelationResourceIds { get; set; }
}

It won’t change the DTO Name but should allow you to query using ?BookedResourceIds=... on the QueryString.

1 Like

Thx Mytz,
i tried to change the naming of the proerty and add some Alias.

It works fine now!

1 Like