diff --git a/MediatR_Demo/MediatR_Demo.csproj b/MediatR_Demo/MediatR_Demo.csproj
index 14554a8..cd231a0 100644
--- a/MediatR_Demo/MediatR_Demo.csproj
+++ b/MediatR_Demo/MediatR_Demo.csproj
@@ -7,6 +7,12 @@
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/MediatR_Demo/Migrations/20220704112336_MovieAdded.Designer.cs b/MediatR_Demo/Migrations/20220704112336_MovieAdded.Designer.cs
new file mode 100644
index 0000000..27332ed
--- /dev/null
+++ b/MediatR_Demo/Migrations/20220704112336_MovieAdded.Designer.cs
@@ -0,0 +1,54 @@
+//
+using System;
+using MediatR_Demo.Repository.Context;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace MediatR_Demo.Migrations
+{
+ [DbContext(typeof(ApplicationDbContext))]
+ [Migration("20220704112336_MovieAdded")]
+ partial class MovieAdded
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.6")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
+
+ modelBuilder.Entity("MediatR_Demo.Domain.Entities.Movie.Movie", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1);
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Genre")
+ .HasColumnType("int");
+
+ b.Property("Rating")
+ .HasColumnType("int");
+
+ b.Property("Title")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Movies");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/MediatR_Demo/Migrations/20220704112336_MovieAdded.cs b/MediatR_Demo/Migrations/20220704112336_MovieAdded.cs
new file mode 100644
index 0000000..992cf0d
--- /dev/null
+++ b/MediatR_Demo/Migrations/20220704112336_MovieAdded.cs
@@ -0,0 +1,34 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace MediatR_Demo.Migrations
+{
+ public partial class MovieAdded : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Movies",
+ columns: table => new
+ {
+ Id = table.Column(type: "bigint", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Title = table.Column(type: "nvarchar(max)", nullable: true),
+ Description = table.Column(type: "nvarchar(max)", nullable: true),
+ Genre = table.Column(type: "int", nullable: false),
+ Rating = table.Column(type: "int", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Movies", x => x.Id);
+ });
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Movies");
+ }
+ }
+}
diff --git a/MediatR_Demo/Migrations/ApplicationDbContextModelSnapshot.cs b/MediatR_Demo/Migrations/ApplicationDbContextModelSnapshot.cs
new file mode 100644
index 0000000..204c077
--- /dev/null
+++ b/MediatR_Demo/Migrations/ApplicationDbContextModelSnapshot.cs
@@ -0,0 +1,52 @@
+//
+using System;
+using MediatR_Demo.Repository.Context;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace MediatR_Demo.Migrations
+{
+ [DbContext(typeof(ApplicationDbContext))]
+ partial class ApplicationDbContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.6")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
+
+ modelBuilder.Entity("MediatR_Demo.Domain.Entities.Movie.Movie", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1);
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Genre")
+ .HasColumnType("int");
+
+ b.Property("Rating")
+ .HasColumnType("int");
+
+ b.Property("Title")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Movies");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/MediatR_Demo/Program.cs b/MediatR_Demo/Program.cs
index 48863a6..4b18767 100644
--- a/MediatR_Demo/Program.cs
+++ b/MediatR_Demo/Program.cs
@@ -1,3 +1,6 @@
+using MediatR_Demo.Repository.Context;
+using Microsoft.EntityFrameworkCore;
+
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
@@ -6,6 +9,8 @@
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
+builder.Services.AddDbContext(
+ options => options.UseSqlServer(builder.Configuration.GetConnectionString("Standard")));
var app = builder.Build();
diff --git a/MediatR_Demo/Repository/Context/ApplicationDbContext.cs b/MediatR_Demo/Repository/Context/ApplicationDbContext.cs
new file mode 100644
index 0000000..e894fcf
--- /dev/null
+++ b/MediatR_Demo/Repository/Context/ApplicationDbContext.cs
@@ -0,0 +1,14 @@
+using MediatR_Demo.Domain.Entities.Movie;
+using Microsoft.EntityFrameworkCore;
+
+namespace MediatR_Demo.Repository.Context
+{
+ public class ApplicationDbContext : DbContext
+ {
+ public ApplicationDbContext(DbContextOptions options) : base(options)
+ {
+ }
+
+ public DbSet Movies { get; set; }
+ }
+}
diff --git a/MediatR_Demo/appsettings.json b/MediatR_Demo/appsettings.json
index 10f68b8..c821a49 100644
--- a/MediatR_Demo/appsettings.json
+++ b/MediatR_Demo/appsettings.json
@@ -1,4 +1,7 @@
{
+ "ConnectionStrings": {
+ "Standard": "Server=localhost;Database=mediatr-demo;Trusted_Connection=True;"
+ },
"Logging": {
"LogLevel": {
"Default": "Information",