For nationality, marriage counts but legal cohabitation (cohabitation légale, wettelijke samenwoning) does not. Same-sex marriages count. For residence, both can.