diff --git a/App.config b/App.config
new file mode 100644
index 0000000..e1fa433
--- /dev/null
+++ b/App.config
@@ -0,0 +1,8 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/App.xaml b/App.xaml
index 600ae3b..7863147 100644
--- a/App.xaml
+++ b/App.xaml
@@ -3,6 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:EmployeeManagementApp">
-
+
diff --git a/EmployeeManagementApp.csproj b/EmployeeManagementApp.csproj
index e3e33e3..0933f93 100644
--- a/EmployeeManagementApp.csproj
+++ b/EmployeeManagementApp.csproj
@@ -8,4 +8,15 @@
true
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
diff --git a/Migrations/20241111130759_InitialCreate.Designer.cs b/Migrations/20241111130759_InitialCreate.Designer.cs
new file mode 100644
index 0000000..47242f0
--- /dev/null
+++ b/Migrations/20241111130759_InitialCreate.Designer.cs
@@ -0,0 +1,55 @@
+//
+using EmployeeManagementApp.Services;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EmployeeManagementApp.Migrations
+{
+ [DbContext(typeof(EmployeeContext))]
+ [Migration("20241111130759_InitialCreate")]
+ partial class InitialCreate
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.10")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("EmployeeManagementApp.Models.Employee", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Position")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Salary")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("VacationDays")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Employees");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Migrations/20241111130759_InitialCreate.cs b/Migrations/20241111130759_InitialCreate.cs
new file mode 100644
index 0000000..998116e
--- /dev/null
+++ b/Migrations/20241111130759_InitialCreate.cs
@@ -0,0 +1,43 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+using MySql.EntityFrameworkCore.Metadata;
+
+#nullable disable
+
+namespace EmployeeManagementApp.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterDatabase()
+ .Annotation("MySQL:Charset", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "Employees",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn),
+ FirstName = table.Column(type: "longtext", nullable: false),
+ LastName = table.Column(type: "longtext", nullable: false),
+ Position = table.Column(type: "longtext", nullable: false),
+ Salary = table.Column(type: "decimal(18,2)", nullable: false),
+ VacationDays = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Employees", x => x.Id);
+ })
+ .Annotation("MySQL:Charset", "utf8mb4");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Employees");
+ }
+ }
+}
diff --git a/Migrations/EmployeeContextModelSnapshot.cs b/Migrations/EmployeeContextModelSnapshot.cs
new file mode 100644
index 0000000..7b5363b
--- /dev/null
+++ b/Migrations/EmployeeContextModelSnapshot.cs
@@ -0,0 +1,52 @@
+//
+using EmployeeManagementApp.Services;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EmployeeManagementApp.Migrations
+{
+ [DbContext(typeof(EmployeeContext))]
+ partial class EmployeeContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.10")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("EmployeeManagementApp.Models.Employee", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Position")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Salary")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("VacationDays")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Employees");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Models/Employee.cs b/Models/Employee.cs
index 008a9c6..2aec55e 100644
--- a/Models/Employee.cs
+++ b/Models/Employee.cs
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -8,6 +10,8 @@ namespace EmployeeManagementApp.Models
{
public class Employee
{
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
diff --git a/Services/EmployeeContext.cs b/Services/EmployeeContext.cs
new file mode 100644
index 0000000..a580328
--- /dev/null
+++ b/Services/EmployeeContext.cs
@@ -0,0 +1,16 @@
+using Microsoft.EntityFrameworkCore;
+using EmployeeManagementApp.Models;
+
+namespace EmployeeManagementApp.Services
+{
+ public class EmployeeContext : DbContext
+ {
+ public DbSet Employees { get; set; }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ // Используем MySQL вместо PostgreSQL
+ optionsBuilder.UseMySQL("Server=localhost;Port=3306;Database=EmployeeDB;User=root;Password=SuperSecretPasswork2003;");
+ }
+ }
+}
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..d57001a
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,23 @@
+version: '3.9'
+
+services:
+ mysql:
+ image: mysql:8.0
+ container_name: employee_db
+ restart: always
+ environment:
+ MYSQL_ROOT_PASSWORD: SuperSecretPasswork2003
+ MYSQL_DATABASE: EmployeeDB
+ ports:
+ - "3306:3306"
+ volumes:
+ - mysql_data:/var/lib/mysql
+ networks:
+ - employee_network
+
+volumes:
+ mysql_data:
+
+networks:
+ employee_network:
+ driver: bridge