Add sqlite database
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ obj/
|
||||
/packages/
|
||||
*.blob
|
||||
.idea/
|
||||
*.db
|
||||
@@ -7,10 +7,16 @@ namespace EstusShots.Server.Services
|
||||
{
|
||||
public EstusShotsContext(DbContextOptions options) : base(options)
|
||||
{
|
||||
ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
||||
Database.EnsureCreated();
|
||||
}
|
||||
|
||||
public DbSet<Season> Seasons { get; set; } = default!;
|
||||
public DbSet<Episode> Episodes { get; set; } = default!;
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Season>().ToTable(nameof(Season));
|
||||
modelBuilder.Entity<Episode>().ToTable(nameof(Episode));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,11 @@ namespace EstusShots.Server
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddDbContext<EstusShotsContext>(
|
||||
opt => opt.UseInMemoryDatabase("debug.db"));
|
||||
opt =>
|
||||
{
|
||||
opt.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
|
||||
opt.UseSqlite(Configuration.GetConnectionString("Sqlite"));
|
||||
});
|
||||
services.AddAutoMapper(typeof(Startup));
|
||||
services.AddControllers().AddJsonOptions(options =>
|
||||
{
|
||||
@@ -57,6 +61,7 @@ namespace EstusShots.Server
|
||||
{
|
||||
app.UseHttpsRedirection();
|
||||
}
|
||||
|
||||
// Enable middleware to serve generated Swagger as a JSON endpoint.
|
||||
app.UseSwagger();
|
||||
|
||||
@@ -69,7 +74,6 @@ namespace EstusShots.Server
|
||||
|
||||
app.UseRouting();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,8 @@
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Sqlite": "DataSource=debug.db;"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=dtos/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Estus/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Estus/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sqlite/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
Reference in New Issue
Block a user