public RandomizerContext CreateContext()
        {
            if (_connection == null)
            {
                try
                {
                    string dbPath = Path.Combine(FileSystem.AppDataDirectory, "randomizer.db");
                    _connection = new SqliteConnection($"Filename={dbPath}");
                }
                catch (Exception)
                {
                    Console.WriteLine("Couldn't create database file. Using local database.");
                    _connection = new SqliteConnection($"DataSource=.\\randomizer.db");
                }

                _connection.Open();

                var options = CreateOptions();
                using (var context = new RandomizerContext(options))
                {
                    context.Database.EnsureCreated();
                }
            }

            return(new RandomizerContext(CreateOptions()));
        }
Exemple #2
0
 public RandomizerController(RandomizerContext context)
 {
     this.context = context;
     randomizers  = new List <IRandomizer> {
         new Randomizer.SMZ3.Randomizer(),
         new Randomizer.SuperMetroid.Randomizer()
     };
 }
Exemple #3
0
        public EFRandomizerDataManager()
        {
            // Context init
            _Context = _Factory.CreateContext();

            // Unit of work init
            _UnitOfWork = new EFUnitOfWork(_Context);

            // Create database
            _Context.Database.EnsureCreated();
        }
Exemple #4
0
 public SeedController(RandomizerContext context)
 {
     this.context = context;
 }
 public MultiworldHub(RandomizerContext context)
 {
     this.context = context;
 }
 public MultiworldController(RandomizerContext context, IHubContext <MultiworldHub> hubContext)
 {
     this.context    = context;
     this.hubContext = hubContext;
 }
 public EntityRegistries(RandomizerContext context)
 {
     this.context = context;
 }