Reputation: 336
When casting an object into a model, all booleans are set to false when they're not provided. Usually this is a helpful feature, but when it comes to updating an object using my API- I can't recognize the difference between the user not providing a field, or it just going to false because of the model casting.
Is there any way to tackle it, or should the user just be required to pass on the field when updating a record?
Upvotes: 0
Views: 66
Reputation: 336
I found a solution! When initializing variables, use a ? after the type. Example:
bool? isActive;
or in VB
Property isActive as Boolean?
Have a nice day!
Upvotes: 1