abp framework return dto id in lowercase

48 Views Asked by At

I Would like to apply

[DataContract]
public class CountryDto : FullAuditedEntityDto<Guid>
{
    [DataMember(Name = "user_name")]
    public String Name { get; set; }
}

to dto it's id in abp framework, but i dont have control over FullAuditedEntityDto. I need this cause my datatable require Id to be id in order to work. hanks in advance.

I tried setting it in odata builder

EntitySetConfiguration<CountryDto> orders = builder.EntitySet<CountryDto>(nameof(Country));
orders.EntityType.HasKey(w => w.Id).Property(f => f.Id).Name = "id";

this solution works, but i still think an decorator is prettier solution. And not just that, decorator allow me to return the same property name in all endpoints, not just odata.

1

There are 1 best solutions below

0
On BEST ANSWER

Turns out odata has it on serialization policy. So, what solved it for me was:

var builder = new ODataConventionModelBuilder();
builder.EnableLowerCamelCase();