Slice the asparagus into lengths of about 5cm/2in. Half fill a large non-stick frying pan with water and bring to the boil. Add the asparagus, bring back to the boil and cook for a minute until just tender. Drain and rinse under running water until cold, then pat dry.
Trim any fat off the bacon and cut into 1cm/½in strips. Return the pan to a low heat, add the oil and gently fry the onion and bacon until lightly browned, stirring regularly.
Add the onion and bacon to the bowl with the asparagus, toss lightly and leave to cool.
Preheat the oven to 200C/400F/Gas 6. Place a baking tray in the oven to heat.
Lightly oil a 20cm/8in loose-based fluted flan tin that’s about 3.5cm/1½in deep. Pour the rest of the oil into a small bowl.
Place a sheet of filo pastry in the flan tin, pressing it firmly against the base and sides. Using the tip of a pastry brush, brush the pastry with a little oil then cover with a second pastry sheet at a right angle to the first. Brush with more oil and cover with a third sheet at the same angle to the first. Brush with the oil and cover with a fourth sheet, running in the same direction as the second. Roll and crumple the overhanding pastry back on to the rim of the tin, lifting slightly above it, and brush lightly with the remaining oil. Place the tin on the baking tray.
Put the cornflour in a non-stick saucepan and stir in 50ml/2fl oz of the milk to make thin paste. Pour over 200ml/7fl oz of the milk and stir well. Bring to a simmer, stirring constantly.
Cook for a minute over a medium heat, stirring, until the sauce is thick and smooth.
Season, then remove from the heat and stir in the rest of the milk to cool and loosen the sauce.
Stir in the beaten eggs until thoroughly combined.
Scatter half the asparagus, bacon and onion mixture over the base of the pastry case and pour the white sauce gently on top. Scatter the remaining asparagus and bacon mixture on top and press down lightly, then sprinkle evenly with the cheese.
Bake on the preheated baking tray in the centre of the oven for 25-30 minutes or until the pastry is lightly browned and crisp and the filling is set.
Take the flan out of the oven and leave to cool in the tin for 10 minutes before removing. Serve warm or cold.