Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7520029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:59:50+00:00 2026-05-30T01:59:50+00:00

I feel abit embarrassed asking about this. Cant seem to find it described anywhere

  • 0

I feel abit embarrassed asking about this. Cant seem to find it described anywhere else though…

Say, we have a webservice method, StoreNewItem(Item item), that takes in a datacontract with all the properties for the item.
We will insert this new item in a database.
Some of the properties are mandatory, and some of these are boolean.

Should we validate the incomming data, i.e. verify that the mandatory fields actually have valid data, or should this be the responsibility of the client calling the webservice?

If yes, how to handle the boolean properties? The client may well ignore them, and they will be stored as false in db, as we have no way of knowing if they where set to false or just ignored/forgotten by the client.

Is it a valid option to use an enum with True, False and Empty instead of bool as a type for these mandatory properties?
Or is this simply not our problem?

All thoughts are welcome!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:59:51+00:00Added an answer on May 30, 2026 at 1:59 am

    Instead of enums, you can use nullable booleans (bool?) which are fully supported by web services.

    IMHO Your checking logic should at least be in the db which can forward the error to the service layer (which in turns should raise a fault). I’d have it at the service level too though so that the error can be raised before hitting the db (validation is part of the business layer too). Having it in the UI too is nice but not mandatory.

    Never assume your clients send you valid data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a very basic R question...and feel a bit bad about asking...but
I have a fairly complex application at this point, and feel as though the
I feel a bit embarrassed for asking this but here goes: I'm using Excel
I feel a bit absurd asking this but I can't find a way to
I feel a bit embarrassed asking this questions, but how the heck can I
Pretty confused right now, while i feel i know a bit about vhosts this
My theory might be a bit weak asking this, so feel free to let
I feel a bit silly asking this as the answer is bound to be
I feel a bit stupid as i can't find the answer to this question,
As a Rails developer I feel a bit stupid asking this question but hopefully

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.