Move entity schema
Move classes for work with DB in root dir. Fix problems with num cycles, after change to Enum
This commit is contained in:
		
							
								
								
									
										24
									
								
								DbCycleVDP/DbFurnace.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								DbCycleVDP/DbFurnace.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
 | 
			
		||||
namespace DbCycleVDP
 | 
			
		||||
{
 | 
			
		||||
    public class DbFurnace : DbContext
 | 
			
		||||
    {
 | 
			
		||||
        public DbSet<TableCycle> Cycles { get; set; }
 | 
			
		||||
        public DbFurnace()
 | 
			
		||||
        {
 | 
			
		||||
            Database.EnsureCreated();
 | 
			
		||||
        }
 | 
			
		||||
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 | 
			
		||||
        {
 | 
			
		||||
//            optionsBuilder.UseMySql("server=127.0.0.1;user=diplom;password=diplom;database=VDPCycles;", new MySqlServerVersion(new Version(8, 0)));
 | 
			
		||||
            optionsBuilder.UseMySql("server=37.79.216.218;user=mytest;password=mytest;database=VDPCycles;", new MySqlServerVersion(new Version(8, 0)));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override void OnModelCreating(ModelBuilder modelBuilder)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										23
									
								
								DbCycleVDP/TableCycle.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								DbCycleVDP/TableCycle.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.ComponentModel.DataAnnotations.Schema;
 | 
			
		||||
using System.ComponentModel.DataAnnotations;
 | 
			
		||||
 | 
			
		||||
namespace DbCycleVDP
 | 
			
		||||
{
 | 
			
		||||
    [Table("Cycles")]
 | 
			
		||||
    public class TableCycle
 | 
			
		||||
    {
 | 
			
		||||
        [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; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user