Electronic component with in-moulded contacts and solenoid