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 789117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:28:28+00:00 2026-05-14T21:28:28+00:00

I develop winforms app. One of my forms accepts user input and calls a

  • 0

I develop winforms app. One of my forms accepts user input and calls a web service to add the input into the DB. The input must be unique, however I have no way of knowing if it is unique in the client side. I send the input to the WS and it is responsible of either adding it to the DB or informing the client that the input already exists.

What is the correct way to implement that?

Should I make two calls to the WS, one to know if it is unique and one to insert into the DB? I sense synchronization issues + two round trips across boundary.

Should I return an enum, ValueNotUnique and ValueInsertedSuccessfully?

Or perhaps throw an exception? That sounds not performance wise, plus I don’t like using exceptions for things I already know that might not work.

Is there a nice design to this mess? Help appreciated, thanks in advance!

  • 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-14T21:28:28+00:00Added an answer on May 14, 2026 at 9:28 pm

    I would probably do something like this:

    • define an enumeration of result values; ValueAlreadyExists, ValueInserted etc.
    • define a return object type that would include
      • the result of the operation, as that enum type
      • if the value already existed – possibly something like an ID or even some of the data
      • if the value was inserted successfully, the new ID

    So you’d have:

    public enum OpResult
    {
       ValueInserted,
       ValueAlreadyExists
    }
    

    and a result type:

    public class ResponseType
    {
        public OpResult Result { get; set; }
        public int UniqueID { get; set; }
    }
    

    With this approach, you can easily

    • extend the enumeration and add more possible outcomes for your operation
    • extend the response type and add more information if you need it
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 489k
  • Answers 489k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to define the route method. Also you're not… May 16, 2026 at 9:03 am
  • Editorial Team
    Editorial Team added an answer SOLVED As with most problems like this, turns out it… May 16, 2026 at 9:03 am
  • Editorial Team
    Editorial Team added an answer I had to use this after the flush to get… May 16, 2026 at 9:03 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

i have some WinForms app (Framework to develop some simple apps), written in C#.
A fast paced foodservice company is wanting me to develop a web order form
Have you ever encountered something so easy to develop but stopped a while to
How feasible is it( and some guidance ) to build a WPF ( Silverlight
I'm at the beginning of my road concerning Programming and Software Development and Design.
OK, I realize that people don't like to install stuff on their PCs if
Recently, I came across Mono and MonoDevelop packages in Ubuntu linux. They claim to
I really want to create a stunning-looking GUI desktop application that looks like, for
Our team develops distributed winform apps. We use ClickOnce for deployment and are very

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.