Preheat oven to 200c/180c fan and bring a large pot of water to boil with 1 tbsp of salt. Cook the green beans for 5-7 minutes until just about tender. Drain the green beans and rinse with cold water to stop them from continuing to cook. Set aside to dry while you make the sauce.
Melt the butter in a large skillet over medium heat. Once the butter is beginning to bubble, add the diced shallot and cook for about three minutes. Add the minced garlic and cook for a minute more.
Once the garlic is fragrant, reduce the heat slightly and add the mushrooms, thyme, 1/2 tsp salt and 1/2 tsp fresh black pepper Sauté for about 10 minutes until the mushrooms are softened.
Add the white wine to the pan and stir. Allow the wine to reduce for about five minutes until very little liquid remains. Add 4 tbsp of flour and stir to coat the mushrooms.
Add the stock and Dijon mustard, stirring until combined. Once the mixture bubbles, add the nutmeg and cream.
When the cream mixture heats up and begins to bubble, remove the skillet from the heat and mix in the cheese. Season with additional salt and pepper to taste.
Place the green beans in the bottom of a large dish or casserole and evenly pour over the sauce. Toss the mixture lightly to combine and sprinkle with the 2 tbsp of cheese before baking for 25 minutes.
While your casserole is cooking, lay out your shallots and coat with 1 tbsp of salt. Let them sit for 10 minutes before patting them dry. Coat the shallots with 2 tbsp of corn flour. Heat a small saucepan with the oil for frying and gently place your shallots into the hot oil. I suggest cooking the shallots in batches and dropping them in one by one so that they don't stick together as easily. Cook the shallots for 2-3 minutes and set aside on a lined tray to drain off excess oil.
If you’re using the pancetta, empty the small pot that you used for your shallots of oil and sauté your pancetta for a few minutes until golden.
Once the green bean casserole is cooked, scatter across the pancetta and shallots, and serve with a bit more fresh black pepper. Serve immediately.