Skip to content

Instantly share code, notes, and snippets.

Created Sep 29, 2018
What would you like to do?
using Microsoft.AspNetCore.Mvc;
namespace JrTech.AspNetCore.Web.Controllers
public class ValuesController : Controller
private readonly IFactory<IRandomNumberGenerator> _numberGeneratorFactory;
public ValuesController(IFactory<IRandomNumberGenerator> numberGeneratorFactory)
_numberGeneratorFactory = numberGeneratorFactory;
// GET api/values
public string Get()
var generator = _numberGeneratorFactory.Create();
return $"randomNumber - {generator.Get()}" ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment