dto - How to hide properties on Azure Mobile Service responses? -


I have a mobile service with model classes and DTO classes. I mapped them through the Flunt API and used the CRUD functions Worked to complete, but in some instances I had problems with Jasonson responses.

Take a user unit with a username and password for example to register a user I have my PostUserDTO method like this:

  // post Table / User DTO public ASICNC work & lt; IHttpActionResult & gt; PostUserDTO (UserDTO Item) {string hashString = PasswordHash.CreateHash (item.Password); item. Password = hash string; UserDTO current = awaiting InsertAsync (item); Present. Password = ""; Return createdarth route ("table", new {id = current.Id}, current); }  

On the method I read the property of the password sent from the client and then proceed to hashed it with salt, then change the value in the object to the database, then I proceed to clear the password so that the results of the hand do not come back.

In this case, the best practice response has to come to the password property, it should be done even when all the users in the table are retrieved, I only want to return specific information, some information generated My server should be out of reaction.

Can I select or change information from reactions? Do I have to prepare another DTO for all types of feedback?

You should read this article, because I think you are going right. .


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -