50d65eebaa
- renaming classi gestione DbModels in - spostamento anagrafica flussi da auth a generale
97 lines
2.7 KiB
C#
97 lines
2.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.Extensions.Configuration;
|
|
using MP.Data.DbModels;
|
|
using NLog;
|
|
|
|
#nullable disable
|
|
// <Auto-Generated>
|
|
// This is here so CodeMaid doesn't reorganize this document
|
|
// </Auto-Generated>
|
|
namespace MP.Data
|
|
{
|
|
public partial class MoonPro_VocContext : DbContext
|
|
{
|
|
#region Private Fields
|
|
|
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
private IConfiguration _configuration;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Public Constructors
|
|
|
|
public MoonPro_VocContext(IConfiguration configuration)
|
|
{
|
|
_configuration = configuration;
|
|
}
|
|
|
|
public MoonPro_VocContext(DbContextOptions<MoonPro_VocContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
|
|
public virtual DbSet<LingueModel> DbSetLilngue { get; set; }
|
|
public virtual DbSet<VocabolarioModel> DbSetVocabolario { 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.Voc");
|
|
|
|
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
|
|
}
|
|
} |