using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace Diplom_B.DB { public class MainDB : DbContext { public DbSet Zakazchiki { get; set; } public DbSet Users { get; set; } public DbSet Izdeliya { get; set; } public MainDB() { //Database.Migrate(); Database.EnsureCreated(); } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlite("Data Source=" + Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "Diplom_B.db;"); } protected override void OnModelCreating(ModelBuilder modelBuilder) { } } public class User { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public string Name { get; set; } public string Pass { get; set; } } public class Zakazchik { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public string Name { get; set; } public string Adres { get; set; } public string Phone { get; set; } } public class Izdelie { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public string Name { get; set; } public string DecNum { get; set; } public string Shifr { get; set; } public string Litera { get; set; } public double Cena { get; set; } public int OtdelRazrab { get; set; } public string Ved { get; set; } public string GlavKonstr { get; set; } } }