none
How to Accommodate “Others-specify” kind of data in an RDBMS RRS feed

  • Question

  • I'm using Entity Framework's Code-First approach to build an MVC app. The domain class has these fields.

    1. Name
    2. City
    3. ModeOfTransport

    Presently, I have created an enum for point 3. The requirement is such that we should provide some options (in a combobox) that are fairly common. Then, there should be an additional option "Others". If you choose others, the app should let you type in the value.

    My idea is to declare a string property (OtherModeOfTransport) which is enabled in the UI only when the user selects Other from the combobox. Though it works, I am not entirely happy with storing a single piece of data in two places, not to mention the chaos caused by typos.

    The other solution that came to my mind is to make ModeOfTransport a string field. This perhaps requires a bit of typing. I thought I would provide auto suggestions for the text input box. But there is a requirement that an Android app must be integrated with it, which is presumed to be offline most of the time.

    Please help me know how best this problem could be contained.

    Monday, December 14, 2015 10:49 AM

All replies

  • I don't see a problem with the initial solution. Sure you'll have to be careful to keep them in sync. You could go down a new type route but it seems like overkill to me.

    http://pauliom.wordpress.com

    Tuesday, December 15, 2015 8:05 AM