public static void InitializeDatabase(GeneAnnotationDBContext context)
        {
            context.Database.Migrate();
            InitializeConstants.Initialize(context);

            var loadHugo = Environment.GetEnvironmentVariable("GA_DB_LOAD_HUGO");

            if (loadHugo != null)
            {
                var hugoLoader = new HugoDataLoader(context, "hugo.csv.short");
                hugoLoader.LoadData();
            }

            var loadUcsc = Environment.GetEnvironmentVariable("GA_DB_LOAD_UCSC");

            if (loadUcsc != null)
            {
                var ucscLoader = new UcscDataLoader(context, "ucsc.csv.short");
                ucscLoader.LoadData();
            }

            var loadLike = Environment.GetEnvironmentVariable("GA_DB_LOAD_LIKE");

            if (loadLike != null)
            {
                var likeLoader = new LikeDataLoader(context, "like.csv.short");
                likeLoader.LoadData();
            }
        }
 /// <inheritdoc />
 public static void InitializeDatabase(GeneAnnotationDBContext context)
 {
     //DbInitializer.Initialize(context);
     context.Database.OpenConnection();
     context.Database.EnsureCreated();
     InitializeConstants.Initialize(context);
 }
Example #3
0
        public void InitializeContantsTest()
        {
            Environment.SetEnvironmentVariable(InitializeConstants.GA_DB_RESET_VARIABLE_NAME, "1");
            InitializeConstants.Initialize(_context);
            var gv = from r in _context.VariantType select r;
            var c  = gv.Count();

            Assert.InRange(c, 1, 30);
        }
        public BaseDbTest(bool initDb = true)
        {
            LoggerFactory = new LoggerFactory();
            LoggerFactory.AddConsole();
            LoggerFactory.AddDebug();

            if (initDb)
            {
                Environment.SetEnvironmentVariable(InitializeConstants.GA_DB_RESET_VARIABLE_NAME, "1");
            }
            var contextOptionsBuilder = new DbContextOptionsBuilder <GeneAnnotationDBContext>();

            contextOptionsBuilder.UseLoggerFactory(LoggerFactory);

            _inMemorySqlite = new SqliteConnection("Data Source=:memory:");
            _inMemorySqlite.Open();
            contextOptionsBuilder.UseSqlite(_inMemorySqlite);

            Context = new GeneAnnotationDBContext(contextOptionsBuilder.Options);

            Context.Database.OpenConnection();
            Context.Database.EnsureCreated();
            InitializeConstants.Initialize(Context);
        }
 public LikeVariantDataLoaderTest()
 {
     InitializeConstants.Initialize(Context);
 }