94 lines
2.6 KiB
C#
94 lines
2.6 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using MP.Data.DbModels.Sched;
|
|
using NLog;
|
|
|
|
#nullable disable
|
|
// <Auto-Generated>
|
|
// This is here so CodeMaid doesn't reorganize this document
|
|
// </Auto-Generated>
|
|
namespace MP.Data
|
|
{
|
|
public partial class MP_SchedContext : DbContext
|
|
{
|
|
#region Private Fields
|
|
|
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
private IConfiguration _configuration;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Public Constructors
|
|
|
|
public MP_SchedContext(IConfiguration configuration)
|
|
{
|
|
_configuration = configuration;
|
|
}
|
|
|
|
public MP_SchedContext(DbContextOptions<MP_SchedContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
public virtual DbSet<PromesseInModel> DbSetPromIn { get; set; }
|
|
public virtual DbSet<PromesseOutModel> DbSetPromOut { 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)
|
|
{
|
|
if (!optionsBuilder.IsConfigured)
|
|
{
|
|
string connString = _configuration.GetConnectionString("MP.Sched");
|
|
|
|
optionsBuilder.UseSqlServer(connString);
|
|
}
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
|
|
|
//modelBuilder.Entity<ConfigModel>(entity =>
|
|
//{
|
|
// entity.HasKey(e => e.Chiave);
|
|
|
|
// entity.ToTable("Config");
|
|
|
|
// entity.Property(e => e.Chiave)
|
|
// .HasMaxLength(50)
|
|
// .HasColumnName("chiave");
|
|
|
|
// entity.Property(e => e.Note).HasColumnName("note");
|
|
|
|
// entity.Property(e => e.Valore).HasColumnName("valore");
|
|
|
|
// entity.Property(e => e.ValoreStd)
|
|
// .HasColumnName("valoreStd")
|
|
// .HasComment("Valore di default/riferimento per la variabile");
|
|
//});
|
|
|
|
//modelBuilder.Entity<VocabolarioModel>(entity =>
|
|
//{
|
|
// entity.HasKey(e => new { e.Lingua, e.Lemma });
|
|
|
|
//});
|
|
|
|
OnModelCreatingPartial(modelBuilder);
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |