Fix init DB

This commit is contained in:
Samuele Locatelli
2021-09-03 14:58:55 +02:00
parent e54a77d85d
commit 17ca3eee8e
6 changed files with 109 additions and 3 deletions
+19 -1
View File
@@ -13,11 +13,16 @@ namespace MP.FileData
{
public partial class MoonPro_ProgContext : DbContext
{
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private IConfiguration _configuration;
#endregion Private Fields
#region Public Constructors
[Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")]
public MoonPro_ProgContext()
{
@@ -50,15 +55,23 @@ namespace MP.FileData
}
}
#endregion Public Constructors
#region Public Properties
public virtual DbSet<ArticoloModel> DbSetArticoli { get; set; }
public virtual DbSet<MacchinaModel> DbSetMacchine { get; set; }
public virtual DbSet<FileModel> DbSetProgFile { get; set; }
#endregion Public Properties
#region Private Methods
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
#endregion Private Methods
#region Protected Methods
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@@ -80,7 +93,12 @@ namespace MP.FileData
{
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
//
modelBuilder.Seed();
OnModelCreatingPartial(modelBuilder);
}
#endregion Protected Methods
}
}
}