コード例 #1
0
        public override void CreateDatabase()
        {
            var context = new SqlLiteDbContext(DataAccess.GetDefaultSqliteConnection(), false);

            if (!context.Set <Weapon>().Any())
            {
                context.Set <Weapon>().AddRange(new DefaultDataFactory().GetWeaponSeed());
                context.SaveChanges();
            }

            if (!context.Set <WeaponAttribute>().Any())
            {
                context.Set <WeaponAttribute>().AddRange(new DefaultDataFactory().GetWeaponAttributeSeed());
                context.SaveChanges();
            }

            context.Dispose();
        }
コード例 #2
0
        public override bool DoesDatabaseExist()
        {
            var result  = true;
            var context = new SqlLiteDbContext(DataAccess.GetDefaultSqliteConnection(), false);

            if (!context.Set <Weapon>().Any())
            {
                result = false;
            }

            if (!context.Set <WeaponAttribute>().Any())
            {
                result = false;
            }

            context.Dispose();

            return(result);
        }