Infinite horizon, ergodic and periodic control for a stochastic infinite-dimensional affine equation