Shotguns can be tricky to use in this game, but in the right situations they can be highly rewarding. Most of them deal high damage, and have a tendency to staggerlock your target. That said, enemies are almost always more lethal in cqc range where the AI has a better chance to hit you. Other than vanguards who can spam biotic charge to keep their shields up, the classes that fare best with shotguns are the ones that have high health, high damage resistance, or ones that can get away without taking too much damage. If you put some points into fitness, infiltrators can sneak into a group with tac cloak and shred small groups of enemies with a shotgun I ran an infiltrator on silver spec'd for health, sticky grenades, and cloak duration. I gave her a Claymore and just had fun one-shotting unsuspecting enemies. It actually worked quite well. The N7 shadow could use shadow strike in much the same way as biotic charge to get close to a group and take them out with a shotgun (disclaimer: don't actually have the shadow, so this is conjecture.) Other than that, any Krogan makes a decent shotgun class, since they generally have high health and shields. Also vorcha, because they can close distances very quickly and bloodlust can make them nearly invincible (as long as you're mindful of you're surroundings, you can survive long enough to find cover if overwhelmed.)
Map choice makes a difference too. It is beneficial to face an enemy around corners so you can retreat if you run low on health. The corridors on firebase glacier, firebase white, or firebase goddess. as well as the enclosed area on firebase jade and the buildings on firebase ghost are good examples. Basically anywhere with cover at your disposal and which forces the enemy into close quarters. If you can't fight them head on, try to get behind them or flank them, so they can't shoot you as you come up. Other than that, dodge, weave, strafe, and roll. AI targeting isn't good against moving targets (except for the bosses. watch out).
Some other tips: some classes have a charging heavy melee which will put you in a very favorable position to blow your target away (assuming your melee doesn't kill him/her/it outright.) Krogan and Vorcha can close distance like this (assuming you are already close enough to lock onto a target). The N7 fury, in particular, has a teleporting heavy melee which has an absurd reach, and her annihilation field can steal an enemy's shields if you spec it right, giving her more survivability.
If it's a long range shotgun duel you're after, Geth Plasma Shotgun is the way to go, as stated. However, there are other shotguns that will do the job too. The Graal Spike Thrower functions similarly, especially with a smart choke. It has a bit of a lead time, but if you can learn to time your shots, it does superior damage to the GPS, (in my experience anyway, I don't actually know the numbers.) and leaves your enemy's with spikes sticking out of them (which you can actually use to see cloaked phantoms and hunters.) It also weighs more, however. The other shotgun is the N7 Crusader. The weight of this one is comparable to the Claymore, however it has a four round clip, reloads very quickly, and fires a single slug straight down the range with pin-point accuracy. Not even kidding, this thing is like a sniper with out the scope. Recoil is kind of severe though, so hope you didn't actually want to use it in close range :3. The Crusader can only be attained through weekend challenges. If you want it (and don't have it already) make sure to check back every weekend to complete the challenge (commendation packs come instantly now. nice.)
Avoid shotguns on any class you want to use powers with (no-brainer, right?) as they will kill your cool down time. If you want a cqb sidearm (not a bad idea depending on the map and enemies), I recommend the tempest, or better yet, the hurricane. If you play vanguard, stick to the lighter shotguns to keep your biotic charge cooldown low.
Above all, know when you're outmatched. Have an exit strategy. Know where you can take cover or retreat to when your shields fail. Don't charge groups if you don't know if you can take them. Be wary of shielded enemies and avoid bosses at all costs if there's no one to back you up. Pick off enemies with a secondary or let them come to you if you can't go to them. When you try and flank enemies, keep an eye out for them trying to flank you.
This may seem like quite a lot, but with practice, things like this can become second nature. The stopping power shotguns have can quickly remove enemies from the field, and allow you to survive if enemy forces engage YOU at close-quarters.(I have died more from being pushed into a corner than anything else. Those AI sure do love close-quarters). With the right set-up, shotguns can melt enemies like nobody's business, save your (and your team's) hide, and clear a room in ten seconds flat. They can also be tremendous fun (this is a game after all.)
Hope this helps