Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
Is there a way to hide order properties when you serialize an order with json?
I think I understand What are u doing here.
The solution is easy you make something called DTO :
-stands for :"Data transmission object" -
lets say you have a class called Order and its like this
Public class Order { public string Name; public string PromoCode ; public int amount }
and you want to show only name ,amount
then you make a DTO
Public class OrderDto { public string Name; public int amount; }
now what you should do is map the proprties you want from the order into the orderDto
order
orderDto
and then return the orderDto serialize it to the java script
serialize it
sorry I delete that answer by mistake i wanted to edit it :( :(
We're actually already using a DTO like you suggest and it works fine, it would just simplify things if it wasn't necessary to map properties from Order to an OrderDto :)
you can use something like auto mapper. or mapster
By the way Matt Brailsford 8x MVP
which he replied to this question but i deleted my answer . and he replied on my deleted answer. he supported the MVP idea.
im telling because i deleted his answer by mistake
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Hide order properties when serialized
Hi,
Is there a way to hide order properties when you serialize an order with json?
I think I understand What are u doing here.
The solution is easy you make something called DTO :
-stands for :"Data transmission object" -
lets say you have a class called Order and its like this
and you want to show only name ,amount
then you make a DTO
now what you should do is map the proprties you want from the
order
into theorderDto
and then return the orderDto
serialize it
to the java scriptsorry I delete that answer by mistake i wanted to edit it :( :(
We're actually already using a DTO like you suggest and it works fine, it would just simplify things if it wasn't necessary to map properties from Order to an OrderDto :)
you can use something like auto mapper. or mapster
By the way Matt Brailsford 8x MVP
which he replied to this question but i deleted my answer . and he replied on my deleted answer. he supported the MVP idea.
im telling because i deleted his answer by mistake
is working on a reply...