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(); }
public void BasicSelect() { // Arrange string result = ""; // Act using (SqlLiteDbContext dbContext = new SqlLiteDbContext(connectionString, Constants.SqlLite.DefaultQueries.Select)) { dbContext.ExecuteQuery(); while (dbContext.RecordSetNotEmptyRead()) { result = dbContext.GetString("name"); } } // Assert Assert.IsFalse(string.IsNullOrEmpty(result)); System.Console.WriteLine(result); }
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); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); using (var client = new SqlLiteDbContext()) { client.Database.EnsureCreated(); } }
public PropertyBLL(SqlLiteDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public OwnerBLL(SqlLiteDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }