CurrStatVDP/Diagram-API/GenerateVDPCycle/DBvdp.cs
2021-05-17 23:22:58 +05:00

47 lines
1.1 KiB
C#

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace GenerateVDPCycle.DB
{
public class VdpDB : DbContext
{
public DbSet<DB.Cycle> Cycles { get; set; }
public VdpDB()
{
Database.EnsureCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseMySql("server=127.0.0.1;user=diplom;password=diplom;database=VDPCycles;");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
}
}
[Table("Cycles")]
public class Cycle
{
[Column("idCycle"), Required, Key]
public int IdCycle { get; set; }
[Column("numVdp")]
public int NumVdp { get; set; }
[Column("numCycle")]
public int NumCycle { get; set; }
[Column("factStart")]
public DateTime FactStart { get; set; }
[Column("thinkEnd")]
public DateTime ThinkEnd { get; set; }
[Column("factEnd")]
public DateTime FactEnd { get; set; }
}
}