Really bad idea. Don't save UI. Have a separate data layer and data binding with UI. Don't save strings with some , save logical data. In particular, 10 2-state check boxes maps to a 10-bit bit set, which is best represented with 16-bit integer (database type "SMALLINT"), one bit per check box, 6 bits remain unused.
If each bit in check box set makes separate semantic sense, create a mapping on a bit set represented by an
enum
type with semantic names for each member. In C# it will look like:
enum OptionSet : System.Int16 {
None = 0,
CaseSensitive = 1 << 0,
Backward = 1 << 1,
UseRegEx = 1 << 2,
Selection = 1 << 3,
}
Store this thing in dababase type casted to
SMALLINT
, type case it back to
OptionSet
for semantic operation (business logic), map to the set of check boxes bit by bit using cycle and bit operations. I trust you know how to set, clear and test a bit…
—SA