static void Main(string[] args) { var config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .AddCommandLine(args) .Build(); var optionsBuilder = new DbContextOptionsBuilder <TrashContext>() .UseSqlServer(config.GetConnectionString("TrashContext")); double timeFactor = config.GetValue <double>("tf", 1.0F); string choosedFillStrategy = config.GetValue <string>("fill", "simplerandom"); IVolumeFillStrategy fillStrategy = new RandomFillVolume(); // Add new strategies here if (choosedFillStrategy == "ontime") { fillStrategy = new OnTimeBasedFillVolume(); } using (var context = new TrashContext(optionsBuilder.Options)) { var faker = new DataFaker(context, fillStrategy); faker.TimeFactor = timeFactor; faker.Run(); } }
public DataFaker(TrashContext trashContext, IVolumeFillStrategy fillStrategy) { _trashContext = trashContext ?? throw new ArgumentNullException(nameof(trashContext)); _newVolumeGenerator = fillStrategy ?? throw new ArgumentNullException(nameof(fillStrategy)); _currentVirtualDateTime = DateTime.Now; _cachedWasteCollectionAreas = new List <WasteCollectionArea>(); TimeFactor = 1.0F; }
public GarbageTrucksController(TrashContext context) { _context = context; }
public WasteCollectionAreasController(TrashContext db) { _db = db; }
public Seed(TrashContext context, UserManager <User> userManager, RoleManager <Role> roleManager) { _context = context; _userManager = userManager; _roleManager = roleManager; }