bitflipper
There are other ways to do it, e.g. using velocity as the determiner, or octave ranges (split keyboard).
However, keyswitching is the most flexible and is actually easily adaptable to live playing as long as there aren't a huge number of keyswitches. If you find it awkward to press a key during performance, or if your controller has a short keyboard such that it's impractical to assign to keys at the far end for switching, you can assign another control instead. If your controller has touch pads, for example, they can be used for switching instead of keys. Sustain pedal or mod wheel are other options.
Here's an example of using the mod wheel to crossfade between sample sets as an alternative to velocity- or key-switching. It's about brass, but the principle applies to any virtual instrument.
That's a very interesting video. If you don't have sample sets with dynamic sample crossfades, that could be difficult to achieve. I suppose if your instrument responds to mod wheel or expression, you can sort of fake it.
I also liked his "breath & bow" part about thinking and playing a sampled instrument like a real one, rather than a keyboard. He has a few other videos that are worth watching as well!