public UnitTest() { string jsonURL = "appsettings.json"; // get the configuration file var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile(jsonURL, optional: true, reloadOnChange: true); IConfiguration configuration = builder.Build(); // Test if we are getting the connection string Console.WriteLine("Connection String:\n"); Console.WriteLine(configuration.GetConnectionString("PizzaStoreAppDB")); // Passing connection string to DBContext var OptionsBuilder = new DbContextOptionsBuilder <PizzaStoreAppContext>(); OptionsBuilder.UseSqlServer(configuration.GetConnectionString("PizzaStoreAppDB")); var options = OptionsBuilder.Options; var context = new PizzaStoreAppContext(options); repo = new WebappRepository(context); }
public AdminController(WebappRepository repo) { Repo = repo; }
public DashboardController(WebappRepository repo) { Repo = repo; }
public HomeController(WebappRepository repo) { Repo = repo; }