I am assuming you mean an "invisible fence". It works for many dogs if they are properly trained to it, but isn't a good idea as a stand alone, because as mentioned some dogs will run through it with the right stimulation. The other problem is that even if it keeps your dog in, it doesn't keep others out. Your dog is vulnerable to attacks by other free running dogs.
Now, if you live in the country, you could put up a "real" electric fence, and a properly constructed "predator" fence will keep most anything in (or out!)
Invisible fence is very useful to keep climbers off a physical fence or diggers away from it, or to keep them out of gardens or other places you don't want them to go.
I am thinking about getting a basenji, and the one thing that keeps deterring me is their ability to scale fences/not care about invisible fences. As I read what their tendencies are, I think the best option would be a combination. A barrier fence of any kind...something to slow them down, make them think/have to navigate. An invisible fence right below it.
From what I hear, they will cross an invisible fence in an instant, and by then, the shock is over. If there were a combination, the basenji would have to stop and begin to navigate the fence if he were to want to go over it. While he was doing that, he would be getting a continuous shock....which in turn would deter him.
He would never have the opportunity to get a "quick shock" on the way by. And no dog is going to, once aware of it, going to sit there an get continuously shocked and be "okay" with it.
They ALL don't scale fences. We are on our 6th and 7th Basenji and none of them have ever tried to go over the fence. Ours stay quite well behind a 4 foot fence. They are never left alone outside when no one is home, however, simply in case some idiot comes over and LETS them out.
If you're looking for an "outside dog"... not the breed. If you are simply concerned about play time outside, then a 6 ft fence contains most. If you have a climber, they have inward leaning caps that stop that.
I do know people who have used a good fence, then an invisible one a couple of feet in so the dog cannot dig under or climb over the fence.