diff --git a/SessionCompanion/SessionCompanion.Database/Migrations/20201203161115_Base-Tables.Designer.cs b/SessionCompanion/SessionCompanion.Database/Migrations/20201203161115_Base-Tables.Designer.cs new file mode 100644 index 0000000..8f35a07 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Migrations/20201203161115_Base-Tables.Designer.cs @@ -0,0 +1,317 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using SessionCompanion.Database; + +namespace SessionCompanion.Database.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20201203161115_Base-Tables")] + partial class BaseTables + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.0"); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.HasKey("Id"); + + b.ToTable("Alignments"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.HasKey("Id"); + + b.ToTable("Backgrounds"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("AlignmentId") + .HasColumnType("int"); + + b.Property("BackgroundId") + .HasColumnType("int"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("ClassId") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("RaceId") + .HasColumnType("int"); + + b.Property("Sex") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AlignmentId"); + + b.HasIndex("BackgroundId"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.HasIndex("ClassId"); + + b.HasIndex("RaceId"); + + b.ToTable("Biographies"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Classes"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Races"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("ArmorClass") + .HasColumnType("int"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("CurrentHealthPoints") + .HasColumnType("int"); + + b.Property("ExperiencePoints") + .HasColumnType("int"); + + b.Property("HealthPoints") + .HasColumnType("int"); + + b.Property("Initiative") + .HasColumnType("int"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Proficiency") + .HasColumnType("int"); + + b.Property("Speed") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.ToTable("Statistics"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Nickname") + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Users"); + + b.HasData( + new + { + Id = 1, + Nickname = "Morwiec", + Password = "123" + }, + new + { + Id = 2, + Nickname = "Cichoklepiec", + Password = "123" + }, + new + { + Id = 3, + Nickname = "Ruletka", + Password = "123" + }); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b => + { + b.HasOne("SessionCompanion.Database.Tables.Alignment", "Alignment") + .WithMany("Biography") + .HasForeignKey("AlignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Background", "Background") + .WithMany("Biography") + .HasForeignKey("BackgroundId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Biography") + .HasForeignKey("SessionCompanion.Database.Tables.Biography", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Class", "Class") + .WithMany("Biography") + .HasForeignKey("ClassId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Race", "Race") + .WithMany("Biography") + .HasForeignKey("RaceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alignment"); + + b.Navigation("Background"); + + b.Navigation("Character"); + + b.Navigation("Class"); + + b.Navigation("Race"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b => + { + b.HasOne("SessionCompanion.Database.Tables.User", "User") + .WithMany("Character") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b => + { + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Statistics") + .HasForeignKey("SessionCompanion.Database.Tables.Statistics", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b => + { + b.Navigation("Biography"); + + b.Navigation("Statistics"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.User", b => + { + b.Navigation("Character"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SessionCompanion/SessionCompanion.Database/Migrations/20201203161115_Base-Tables.cs b/SessionCompanion/SessionCompanion.Database/Migrations/20201203161115_Base-Tables.cs new file mode 100644 index 0000000..966a889 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Migrations/20201203161115_Base-Tables.cs @@ -0,0 +1,248 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace SessionCompanion.Database.Migrations +{ + public partial class BaseTables : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Alignments", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1") + }, + constraints: table => + { + table.PrimaryKey("PK_Alignments", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Backgrounds", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1") + }, + constraints: table => + { + table.PrimaryKey("PK_Backgrounds", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Classes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Classes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Races", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Races", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Nickname = table.Column(type: "nvarchar(max)", nullable: true), + Password = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Characters", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + UserId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Characters", x => x.Id); + table.ForeignKey( + name: "FK_Characters_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Biographies", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CharacterId = table.Column(type: "int", nullable: false), + Name = table.Column(type: "nvarchar(max)", nullable: true), + ClassId = table.Column(type: "int", nullable: false), + RaceId = table.Column(type: "int", nullable: false), + AlignmentId = table.Column(type: "int", nullable: false), + BackgroundId = table.Column(type: "int", nullable: false), + Sex = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Biographies", x => x.Id); + table.ForeignKey( + name: "FK_Biographies_Alignments_AlignmentId", + column: x => x.AlignmentId, + principalTable: "Alignments", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Biographies_Backgrounds_BackgroundId", + column: x => x.BackgroundId, + principalTable: "Backgrounds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Biographies_Characters_CharacterId", + column: x => x.CharacterId, + principalTable: "Characters", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Biographies_Classes_ClassId", + column: x => x.ClassId, + principalTable: "Classes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Biographies_Races_RaceId", + column: x => x.RaceId, + principalTable: "Races", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Statistics", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CharacterId = table.Column(type: "int", nullable: false), + ExperiencePoints = table.Column(type: "int", nullable: false), + Level = table.Column(type: "int", nullable: false), + Speed = table.Column(type: "int", nullable: false), + Initiative = table.Column(type: "int", nullable: false), + HealthPoints = table.Column(type: "int", nullable: false), + CurrentHealthPoints = table.Column(type: "int", nullable: false), + ArmorClass = table.Column(type: "int", nullable: false), + Proficiency = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Statistics", x => x.Id); + table.ForeignKey( + name: "FK_Statistics_Characters_CharacterId", + column: x => x.CharacterId, + principalTable: "Characters", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.InsertData( + table: "Users", + columns: new[] { "Id", "Nickname", "Password" }, + values: new object[] { 1, "Morwiec", "123" }); + + migrationBuilder.InsertData( + table: "Users", + columns: new[] { "Id", "Nickname", "Password" }, + values: new object[] { 2, "Cichoklepiec", "123" }); + + migrationBuilder.InsertData( + table: "Users", + columns: new[] { "Id", "Nickname", "Password" }, + values: new object[] { 3, "Ruletka", "123" }); + + migrationBuilder.CreateIndex( + name: "IX_Biographies_AlignmentId", + table: "Biographies", + column: "AlignmentId"); + + migrationBuilder.CreateIndex( + name: "IX_Biographies_BackgroundId", + table: "Biographies", + column: "BackgroundId"); + + migrationBuilder.CreateIndex( + name: "IX_Biographies_CharacterId", + table: "Biographies", + column: "CharacterId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Biographies_ClassId", + table: "Biographies", + column: "ClassId"); + + migrationBuilder.CreateIndex( + name: "IX_Biographies_RaceId", + table: "Biographies", + column: "RaceId"); + + migrationBuilder.CreateIndex( + name: "IX_Characters_UserId", + table: "Characters", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Statistics_CharacterId", + table: "Statistics", + column: "CharacterId", + unique: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Biographies"); + + migrationBuilder.DropTable( + name: "Statistics"); + + migrationBuilder.DropTable( + name: "Alignments"); + + migrationBuilder.DropTable( + name: "Backgrounds"); + + migrationBuilder.DropTable( + name: "Classes"); + + migrationBuilder.DropTable( + name: "Races"); + + migrationBuilder.DropTable( + name: "Characters"); + + migrationBuilder.DropTable( + name: "Users"); + } + } +} diff --git a/SessionCompanion/SessionCompanion.Database/Migrations/ApplicationDbContextModelSnapshot.cs b/SessionCompanion/SessionCompanion.Database/Migrations/ApplicationDbContextModelSnapshot.cs new file mode 100644 index 0000000..0b86cba --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Migrations/ApplicationDbContextModelSnapshot.cs @@ -0,0 +1,315 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using SessionCompanion.Database; + +namespace SessionCompanion.Database.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + partial class ApplicationDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.0"); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.HasKey("Id"); + + b.ToTable("Alignments"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.HasKey("Id"); + + b.ToTable("Backgrounds"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("AlignmentId") + .HasColumnType("int"); + + b.Property("BackgroundId") + .HasColumnType("int"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("ClassId") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("RaceId") + .HasColumnType("int"); + + b.Property("Sex") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AlignmentId"); + + b.HasIndex("BackgroundId"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.HasIndex("ClassId"); + + b.HasIndex("RaceId"); + + b.ToTable("Biographies"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Classes"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Races"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("ArmorClass") + .HasColumnType("int"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("CurrentHealthPoints") + .HasColumnType("int"); + + b.Property("ExperiencePoints") + .HasColumnType("int"); + + b.Property("HealthPoints") + .HasColumnType("int"); + + b.Property("Initiative") + .HasColumnType("int"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Proficiency") + .HasColumnType("int"); + + b.Property("Speed") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.ToTable("Statistics"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Nickname") + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Users"); + + b.HasData( + new + { + Id = 1, + Nickname = "Morwiec", + Password = "123" + }, + new + { + Id = 2, + Nickname = "Cichoklepiec", + Password = "123" + }, + new + { + Id = 3, + Nickname = "Ruletka", + Password = "123" + }); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b => + { + b.HasOne("SessionCompanion.Database.Tables.Alignment", "Alignment") + .WithMany("Biography") + .HasForeignKey("AlignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Background", "Background") + .WithMany("Biography") + .HasForeignKey("BackgroundId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Biography") + .HasForeignKey("SessionCompanion.Database.Tables.Biography", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Class", "Class") + .WithMany("Biography") + .HasForeignKey("ClassId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Race", "Race") + .WithMany("Biography") + .HasForeignKey("RaceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alignment"); + + b.Navigation("Background"); + + b.Navigation("Character"); + + b.Navigation("Class"); + + b.Navigation("Race"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b => + { + b.HasOne("SessionCompanion.Database.Tables.User", "User") + .WithMany("Character") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b => + { + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Statistics") + .HasForeignKey("SessionCompanion.Database.Tables.Statistics", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b => + { + b.Navigation("Biography"); + + b.Navigation("Statistics"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.User", b => + { + b.Navigation("Character"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SessionCompanion/SessionCompanion.Database/SessionCompanion.Database.csproj b/SessionCompanion/SessionCompanion.Database/SessionCompanion.Database.csproj index b9c845f..6858ae5 100644 --- a/SessionCompanion/SessionCompanion.Database/SessionCompanion.Database.csproj +++ b/SessionCompanion/SessionCompanion.Database/SessionCompanion.Database.csproj @@ -6,6 +6,15 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/SessionCompanion/SessionCompanion/SessionCompanion.csproj b/SessionCompanion/SessionCompanion/SessionCompanion.csproj index 83b3adc..07210e5 100644 --- a/SessionCompanion/SessionCompanion/SessionCompanion.csproj +++ b/SessionCompanion/SessionCompanion/SessionCompanion.csproj @@ -14,6 +14,11 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -27,6 +32,10 @@ + + + + diff --git a/SessionCompanion/SessionCompanion/Startup.cs b/SessionCompanion/SessionCompanion/Startup.cs index 22af514..11ae8f2 100644 --- a/SessionCompanion/SessionCompanion/Startup.cs +++ b/SessionCompanion/SessionCompanion/Startup.cs @@ -2,10 +2,12 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.SpaServices.AngularCli; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; - +using SessionCompanion.Database; + namespace SessionCompanion { public class Startup @@ -27,6 +29,9 @@ namespace SessionCompanion { configuration.RootPath = "ClientApp/dist"; }); + services.AddDbContext(options => + options.UseSqlServer( + Configuration.GetConnectionString("DefaultConnection"))); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/SessionCompanion/SessionCompanion/appsettings.json b/SessionCompanion/SessionCompanion/appsettings.json index ad75fee..cb23b68 100644 --- a/SessionCompanion/SessionCompanion/appsettings.json +++ b/SessionCompanion/SessionCompanion/appsettings.json @@ -1,10 +1,13 @@ { + "ConnectionStrings": { + "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=SessionCompanion;Trusted_Connection=True;MultipleActiveResultSets=true" + }, "Logging": { - "LogLevel": { + "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" - } - }, -"AllowedHosts": "*" + } + }, + "AllowedHosts": "*" }