Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
JsonIgnore
Message
From
23/09/2014 11:59:11
 
General information
Forum:
ASP.NET
Category:
Client-side development
Title:
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01608052
Message ID:
01608058
Views:
24
This message has been marked as a message which has helped to the initial question of the thread.
>>>Hi everybody,
>>>
>>>I am wondering when do I need to use this attribute and what exactly does this attribute do.
>>>
>>>Say, I want to have a property in my model that I am going to set in JavaScript code to pass back to the server. I don't want to retrieve that property.
>>>
>>>So, is this property a good candidate for this attribute?
>>>
>>>Thanks in advance.
>>
>>JsonIgnore is used to prevent a property in your model from being serialized to JSON. Use it when you don't want to send that property to the client via JSON. Your property will still be retrieved when you fetch it from the database (unless you have a projection that doesn't include that property).
>
>
>This property is not a column in the database. I created a new property called CalculateSuffix and I set it from the JavaScript. So, do I need to use this attribute for that property or not or it doesn't matter?

Is it a server side property on a class that is serialized as JSON and you don't want that property serialized? If yes, then add the attribute. If no, then you probably don't need it. If you are not sure, test both and see which works better.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform