Review libreria LicMan.DB
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using LiMan.DB.DatabaseModels;
|
||||
using LiMan.DB.DBModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
using System;
|
||||
@@ -53,42 +54,176 @@ namespace LiMan.DB.Controllers
|
||||
//Log.Info("Dispose di GWMSController");
|
||||
}
|
||||
|
||||
public List<AnagApplicazioni> GetApplicazioni()
|
||||
public List<ApplicativoModel> GetApplicazioni()
|
||||
{
|
||||
List<AnagApplicazioni> dbResult = new List<AnagApplicazioni>();
|
||||
List<ApplicativoModel> dbResult = new List<ApplicativoModel>();
|
||||
using (LicManContext localDbCtx = new LicManContext(_configuration))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetApplicazioni
|
||||
.DbSetApp
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public List<AnagInstallazioni> GetInstallazioni()
|
||||
public List<InstallazioneModel> GetInstallazioni()
|
||||
{
|
||||
List<AnagInstallazioni> dbResult = new List<AnagInstallazioni>();
|
||||
List<InstallazioneModel> dbResult = new List<InstallazioneModel>();
|
||||
using (LicManContext localDbCtx = new LicManContext(_configuration))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetInstallazioni
|
||||
.DbSetInst
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public List<LicenzeAttive> GetLicenze()
|
||||
public List<LicenzaModel> GetLicenze()
|
||||
{
|
||||
List<LicenzeAttive> dbResult = new List<LicenzeAttive>();
|
||||
List<LicenzaModel> dbResult = new List<LicenzaModel>();
|
||||
using (LicManContext localDbCtx = new LicManContext(_configuration))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetLicenzeAttive
|
||||
.DbSetLicenze
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public List<LicenzaModel> GetLicenzeFilt(bool OnlyActive, string CodApp, string CodInst)
|
||||
{
|
||||
List<LicenzaModel> dbResult = new List<LicenzaModel>();
|
||||
using (LicManContext localDbCtx = new LicManContext(_configuration))
|
||||
{
|
||||
DateTime oggi = DateTime.Today;
|
||||
dbResult = localDbCtx
|
||||
.DbSetLicenze
|
||||
.Where(x => (x.CodApp == CodApp || string.IsNullOrEmpty(CodApp)) && (x.CodInst == CodInst || string.IsNullOrEmpty(CodInst)) && (!OnlyActive || x.Scadenza > oggi))
|
||||
.OrderByDescending(o => o.Scadenza)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Annulla modifiche su una specifica entity (cancel update)
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool rollBackEntity(object item)
|
||||
{
|
||||
bool answ = false;
|
||||
using (LicManContext localDbCtx = new LicManContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (localDbCtx.Entry(item).State == EntityState.Deleted || localDbCtx.Entry(item).State == EntityState.Modified)
|
||||
{
|
||||
localDbCtx.Entry(item).Reload();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public bool UpdateApplicazioni(ApplicativoModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
using (LicManContext localDbCtx = new LicManContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
ApplicativoModel currData = localDbCtx
|
||||
.DbSetApp
|
||||
.Where(x => x.CodApp == updItem.CodApp)
|
||||
.FirstOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
// aggiorno valori
|
||||
currData.Descrizione = updItem.Descrizione;
|
||||
localDbCtx.Entry(currData).State = EntityState.Modified;
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in UpdateApplicazioni:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public bool UpdateInstallazioni(InstallazioneModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
using (LicManContext localDbCtx = new LicManContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
InstallazioneModel currData = localDbCtx
|
||||
.DbSetInst
|
||||
.Where(x => x.CodInst == updItem.CodInst)
|
||||
.FirstOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
// aggiorno valori
|
||||
currData.Descrizione = updItem.Descrizione;
|
||||
currData.Cliente = updItem.Cliente;
|
||||
currData.Contatto = updItem.Contatto;
|
||||
currData.Email = updItem.Email;
|
||||
localDbCtx.Entry(currData).State = EntityState.Modified;
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in UpdateApplicazioni:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public bool UpdateLicenze(LicenzaModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
using (LicManContext localDbCtx = new LicManContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
LicenzaModel currData = localDbCtx
|
||||
.DbSetLicenze
|
||||
.Where(x => x.IdxLic == updItem.IdxLic)
|
||||
.FirstOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
// aggiorno valori
|
||||
currData.CodApp = updItem.CodApp;
|
||||
currData.CodInst = updItem.CodInst;
|
||||
currData.NumLicenze = updItem.NumLicenze;
|
||||
currData.Descrizione = updItem.Descrizione;
|
||||
currData.Chiave = updItem.Chiave;
|
||||
currData.Locked = updItem.Locked;
|
||||
currData.IdxLicParent = updItem.IdxLicParent;
|
||||
currData.Scadenza = updItem.Scadenza;
|
||||
localDbCtx.Entry(currData).State = EntityState.Modified;
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in UpdateLicenze:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace LiMan.DB.DBModels
|
||||
{
|
||||
[Table("Applicativi")]
|
||||
public partial class ApplicativoModel
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
//public Applicativo()
|
||||
//{
|
||||
// LicenzeAttives = new HashSet<Licenza>();
|
||||
//}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Key]
|
||||
[MaxLength(50)]
|
||||
public string CodApp { get; set; }
|
||||
|
||||
[MaxLength(250)]
|
||||
public string Descrizione { get; set; }
|
||||
|
||||
//public virtual ICollection<Licenza> LicenzeAttives { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
+15
-9
@@ -6,26 +6,32 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiMan.DB.DatabaseModels
|
||||
namespace LiMan.DB.DBModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("AnagInstallazioni")]
|
||||
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
|
||||
public partial class AnagInstallazioni
|
||||
[Table("Installazioni")]
|
||||
public partial class InstallazioneModel
|
||||
{
|
||||
public AnagInstallazioni()
|
||||
{
|
||||
LicenzeAttives = new HashSet<LicenzeAttive>();
|
||||
}
|
||||
//public Installazione()
|
||||
//{
|
||||
// LicenzeAttives = new HashSet<Licenza>();
|
||||
//}
|
||||
|
||||
[Key]
|
||||
public string Installazione { get; set; }
|
||||
[MaxLength(50)]
|
||||
public string CodInst { get; set; }
|
||||
[MaxLength(250)]
|
||||
public string Descrizione { get; set; }
|
||||
[MaxLength(250)]
|
||||
public string Cliente { get; set; }
|
||||
[MaxLength(250)]
|
||||
public string Contatto { get; set; }
|
||||
[MaxLength(250)]
|
||||
public string Email { get; set; }
|
||||
|
||||
public virtual ICollection<LicenzeAttive> LicenzeAttives { get; set; }
|
||||
//public virtual ICollection<Licenza> LicenzeAttives { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiMan.DB.DBModels
|
||||
{
|
||||
public partial class LicManContext : 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 LicManContext()
|
||||
{
|
||||
}
|
||||
|
||||
public LicManContext(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public LicManContext(DbContextOptions<LicManContext> options) : base(options)
|
||||
{
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Exception during context initialization 02");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<ApplicativoModel> DbSetApp { get; set; }
|
||||
|
||||
public virtual DbSet<InstallazioneModel> DbSetInst { get; set; }
|
||||
|
||||
public virtual DbSet<LicenzaModel> DbSetLicenze { 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("LiMan.DB");
|
||||
if (!string.IsNullOrEmpty(connString))
|
||||
{
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
}
|
||||
else
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=SQLSTEAM;Database=LiMan.DB;Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void DbForceMigrate()
|
||||
{
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
Log.Info("DbForceMigrate: done!");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "DbForceMigrate: Exception during context initialization 01");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiMan.DB.DBModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
|
||||
[Table("Licenze")]
|
||||
public partial class LicenzaModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int IdxLic { get; set; }
|
||||
public string CodApp { get; set; }
|
||||
public string CodInst { get; set; }
|
||||
public int NumLicenze { get; set; } = 0;
|
||||
public string Descrizione { get; set; }
|
||||
public DateTime Scadenza { get; set; } = DateTime.Today.AddYears(-1);
|
||||
|
||||
public string Chiave { get; set; }
|
||||
|
||||
public int IdxLicParent { get; set; } = 0;
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
[NotMapped]
|
||||
public string ChiaveCalc
|
||||
{
|
||||
get
|
||||
{
|
||||
return Core.licenseManGLS.getAuthKey(CodInst, CodApp, NumLicenze, Scadenza);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public bool IsActive
|
||||
{
|
||||
get => (Scadenza.Subtract(DateTime.Today).TotalDays > 0);
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public bool IsValid
|
||||
{
|
||||
get => Chiave.Equals(ChiaveCalc);
|
||||
}
|
||||
|
||||
[ForeignKey("CodApp")]
|
||||
public virtual ApplicativoModel ApplicativoNav{ get; set; }
|
||||
[ForeignKey("CodInst")]
|
||||
public virtual InstallazioneModel InstallazioneNav{ get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiMan.DB.DatabaseModels
|
||||
{
|
||||
public partial class AnagApplicazioni
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public AnagApplicazioni()
|
||||
{
|
||||
LicenzeAttives = new HashSet<LicenzeAttive>();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string Applicativo { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
|
||||
public virtual ICollection<LicenzeAttive> LicenzeAttives { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -1,259 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiMan.DB.DatabaseModels
|
||||
{
|
||||
public partial class LicManContext : 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 LicManContext()
|
||||
{
|
||||
}
|
||||
|
||||
public LicManContext(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public LicManContext(DbContextOptions<LicManContext> options) : base(options)
|
||||
{
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Exception during context initialization 02");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<AnagApplicazioni> DbSetApplicazioni { get; set; }
|
||||
|
||||
public virtual DbSet<AnagInstallazioni> DbSetInstallazioni { get; set; }
|
||||
|
||||
public virtual DbSet<LicenzeAttive> DbSetLicenzeAttive { get; set; }
|
||||
|
||||
public virtual DbSet<Permessi> DbSetPermessi { get; set; }
|
||||
|
||||
public virtual DbSet<Permessi2Funzione> DbSetPermessi2Funzione { 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("LiMan.DB");
|
||||
if (!string.IsNullOrEmpty(connString))
|
||||
{
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
}
|
||||
else
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=SQLSTEAM;Database=LiMan.DB;Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
|
||||
modelBuilder.Entity<AnagApplicazioni>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Applicativo);
|
||||
|
||||
entity.ToTable("AnagApplicazioni");
|
||||
|
||||
entity.Property(e => e.Applicativo)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("applicativo");
|
||||
|
||||
entity.Property(e => e.Descrizione)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("descrizione");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagInstallazioni>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Installazione);
|
||||
|
||||
entity.ToTable("AnagInstallazioni");
|
||||
|
||||
entity.Property(e => e.Installazione)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("installazione");
|
||||
|
||||
entity.Property(e => e.Contatto)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("contatto");
|
||||
|
||||
entity.Property(e => e.Descrizione)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("descrizione");
|
||||
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("email");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<LicenzeAttive>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxLic)
|
||||
.HasName("PK_AnagKeyValue");
|
||||
|
||||
entity.ToTable("LicenzeAttive");
|
||||
|
||||
entity.Property(e => e.IdxLic).HasColumnName("idxLic");
|
||||
|
||||
entity.Property(e => e.Applicativo)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("applicativo")
|
||||
.HasDefaultValueSql("(N'-')");
|
||||
|
||||
entity.Property(e => e.Descrizione)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("descrizione")
|
||||
.HasDefaultValueSql("('-')");
|
||||
|
||||
entity.Property(e => e.Installazione)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("installazione")
|
||||
.HasDefaultValueSql("(N'SteamWare')");
|
||||
|
||||
entity.Property(e => e.Licenza)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("licenza")
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.NumLicenze)
|
||||
.HasColumnName("numLicenze")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.Scadenza)
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("scadenza");
|
||||
|
||||
entity.HasOne(d => d.ApplicativoNavigation)
|
||||
.WithMany(p => p.LicenzeAttives)
|
||||
.HasForeignKey(d => d.Applicativo)
|
||||
.HasConstraintName("FK_AnagKeyValue_AnagApplicazioni");
|
||||
|
||||
entity.HasOne(d => d.InstallazioneNavigation)
|
||||
.WithMany(p => p.LicenzeAttives)
|
||||
.HasForeignKey(d => d.Installazione)
|
||||
.HasConstraintName("FK_AnagKeyValue_AnagInstallazioni");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Permessi>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.CodPermesso);
|
||||
|
||||
entity.ToTable("Permessi");
|
||||
|
||||
entity.Property(e => e.CodPermesso)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("COD_PERMESSO");
|
||||
|
||||
entity.Property(e => e.Descrizione)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("DESCRIZIONE");
|
||||
|
||||
entity.Property(e => e.Gruppo).HasColumnName("GRUPPO");
|
||||
|
||||
entity.Property(e => e.Nome)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("NOME");
|
||||
|
||||
entity.Property(e => e.Numero).HasColumnName("NUMERO");
|
||||
|
||||
entity.Property(e => e.Url)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("URL");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Permessi2Funzione>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.CodPermesso, e.CodFunzione });
|
||||
|
||||
entity.ToTable("Permessi2Funzione");
|
||||
|
||||
entity.Property(e => e.CodPermesso)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("COD_PERMESSO");
|
||||
|
||||
entity.Property(e => e.CodFunzione)
|
||||
.HasMaxLength(31)
|
||||
.HasColumnName("COD_FUNZIONE");
|
||||
|
||||
entity.Property(e => e.Readwrite)
|
||||
.HasMaxLength(1)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("READWRITE")
|
||||
.IsFixedLength(true);
|
||||
|
||||
entity.HasOne(d => d.CodPermessoNavigation)
|
||||
.WithMany(p => p.Permessi2Funziones)
|
||||
.HasForeignKey(d => d.CodPermesso)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_Permessi2Funzione_Permessi");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void DbForceMigrate()
|
||||
{
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
Log.Info("DbForceMigrate: done!");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "DbForceMigrate: Exception during context initialization 01");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiMan.DB.DatabaseModels
|
||||
{
|
||||
public partial class LicenzeAttive
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Applicativo { get; set; }
|
||||
public virtual AnagApplicazioni ApplicativoNavigation { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
public int IdxLic { get; set; }
|
||||
public string Installazione { get; set; }
|
||||
public virtual AnagInstallazioni InstallazioneNavigation { get; set; }
|
||||
public string Licenza { get; set; }
|
||||
public int? NumLicenze { get; set; }
|
||||
public DateTime Scadenza { get; set; } = DateTime.Today.AddYears(-1);
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiMan.DB.DatabaseModels
|
||||
{
|
||||
public partial class Permessi
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public Permessi()
|
||||
{
|
||||
Permessi2Funziones = new HashSet<Permessi2Funzione>();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string CodPermesso { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
public int? Gruppo { get; set; }
|
||||
public string Nome { get; set; }
|
||||
public int? Numero { get; set; }
|
||||
public virtual ICollection<Permessi2Funzione> Permessi2Funziones { get; set; }
|
||||
public string Url { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LiMan.DB.DatabaseModels
|
||||
{
|
||||
public partial class Permessi2Funzione
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string CodFunzione { get; set; }
|
||||
public string CodPermesso { get; set; }
|
||||
public virtual Permessi CodPermessoNavigation { get; set; }
|
||||
public string Readwrite { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="DTO\" />
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
-233
@@ -1,233 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using LiMan.DB.DatabaseModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace LiMan.DB.Migrations
|
||||
{
|
||||
[DbContext(typeof(LicManContext))]
|
||||
[Migration("20211008094940_InitDb")]
|
||||
partial class InitDb
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.10")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagApplicazioni", b =>
|
||||
{
|
||||
b.Property<string>("Applicativo")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("applicativo");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("descrizione");
|
||||
|
||||
b.HasKey("Applicativo");
|
||||
|
||||
b.ToTable("AnagApplicazioni");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagInstallazioni", b =>
|
||||
{
|
||||
b.Property<string>("Installazione")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("installazione");
|
||||
|
||||
b.Property<string>("Contatto")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("contatto");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("descrizione");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("email");
|
||||
|
||||
b.HasKey("Installazione");
|
||||
|
||||
b.ToTable("AnagInstallazioni");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.LicenzeAttive", b =>
|
||||
{
|
||||
b.Property<int>("IdxLic")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("idxLic")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Applicativo")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("applicativo")
|
||||
.HasDefaultValueSql("(N'-')");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("nvarchar(250)")
|
||||
.HasColumnName("descrizione")
|
||||
.HasDefaultValueSql("('-')");
|
||||
|
||||
b.Property<string>("Installazione")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("installazione")
|
||||
.HasDefaultValueSql("(N'SteamWare')");
|
||||
|
||||
b.Property<string>("Licenza")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("nvarchar(250)")
|
||||
.HasColumnName("licenza")
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
b.Property<int?>("NumLicenze")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("numLicenze")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
b.Property<DateTime>("Scadenza")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("scadenza");
|
||||
|
||||
b.HasKey("IdxLic")
|
||||
.HasName("PK_AnagKeyValue");
|
||||
|
||||
b.HasIndex("Applicativo");
|
||||
|
||||
b.HasIndex("Installazione");
|
||||
|
||||
b.ToTable("LicenzeAttive");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi", b =>
|
||||
{
|
||||
b.Property<string>("CodPermesso")
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("COD_PERMESSO");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("DESCRIZIONE");
|
||||
|
||||
b.Property<int?>("Gruppo")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("GRUPPO");
|
||||
|
||||
b.Property<string>("Nome")
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("NOME");
|
||||
|
||||
b.Property<int?>("Numero")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("NUMERO");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnName("URL");
|
||||
|
||||
b.HasKey("CodPermesso");
|
||||
|
||||
b.ToTable("Permessi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi2Funzione", b =>
|
||||
{
|
||||
b.Property<string>("CodPermesso")
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("COD_PERMESSO");
|
||||
|
||||
b.Property<string>("CodFunzione")
|
||||
.HasMaxLength(31)
|
||||
.HasColumnType("nvarchar(31)")
|
||||
.HasColumnName("COD_FUNZIONE");
|
||||
|
||||
b.Property<string>("Readwrite")
|
||||
.HasMaxLength(1)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("char(1)")
|
||||
.HasColumnName("READWRITE")
|
||||
.IsFixedLength(true);
|
||||
|
||||
b.HasKey("CodPermesso", "CodFunzione");
|
||||
|
||||
b.ToTable("Permessi2Funzione");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.LicenzeAttive", b =>
|
||||
{
|
||||
b.HasOne("LiMan.DB.DatabaseModels.AnagApplicazioni", "ApplicativoNavigation")
|
||||
.WithMany("LicenzeAttives")
|
||||
.HasForeignKey("Applicativo")
|
||||
.HasConstraintName("FK_AnagKeyValue_AnagApplicazioni");
|
||||
|
||||
b.HasOne("LiMan.DB.DatabaseModels.AnagInstallazioni", "InstallazioneNavigation")
|
||||
.WithMany("LicenzeAttives")
|
||||
.HasForeignKey("Installazione")
|
||||
.HasConstraintName("FK_AnagKeyValue_AnagInstallazioni");
|
||||
|
||||
b.Navigation("ApplicativoNavigation");
|
||||
|
||||
b.Navigation("InstallazioneNavigation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi2Funzione", b =>
|
||||
{
|
||||
b.HasOne("LiMan.DB.DatabaseModels.Permessi", "CodPermessoNavigation")
|
||||
.WithMany("Permessi2Funziones")
|
||||
.HasForeignKey("CodPermesso")
|
||||
.HasConstraintName("FK_Permessi2Funzione_Permessi")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CodPermessoNavigation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagApplicazioni", b =>
|
||||
{
|
||||
b.Navigation("LicenzeAttives");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagInstallazioni", b =>
|
||||
{
|
||||
b.Navigation("LicenzeAttives");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi", b =>
|
||||
{
|
||||
b.Navigation("Permessi2Funziones");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace LiMan.DB.Migrations
|
||||
{
|
||||
public partial class InitDb : Migration
|
||||
{
|
||||
#region Protected Methods
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "LicenzeAttive");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Permessi2Funzione");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AnagApplicazioni");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AnagInstallazioni");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Permessi");
|
||||
}
|
||||
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AnagApplicazioni",
|
||||
columns: table => new
|
||||
{
|
||||
applicativo = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
descrizione = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AnagApplicazioni", x => x.applicativo);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AnagInstallazioni",
|
||||
columns: table => new
|
||||
{
|
||||
installazione = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
descrizione = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
contatto = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AnagInstallazioni", x => x.installazione);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Permessi",
|
||||
columns: table => new
|
||||
{
|
||||
COD_PERMESSO = table.Column<string>(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false),
|
||||
URL = table.Column<string>(type: "varchar(250)", unicode: false, maxLength: 250, nullable: false),
|
||||
GRUPPO = table.Column<int>(type: "int", nullable: true),
|
||||
NUMERO = table.Column<int>(type: "int", nullable: true),
|
||||
NOME = table.Column<string>(type: "varchar(50)", unicode: false, maxLength: 50, nullable: true),
|
||||
DESCRIZIONE = table.Column<string>(type: "varchar(50)", unicode: false, maxLength: 50, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Permessi", x => x.COD_PERMESSO);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LicenzeAttive",
|
||||
columns: table => new
|
||||
{
|
||||
idxLic = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
applicativo = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, defaultValueSql: "(N'-')"),
|
||||
descrizione = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true, defaultValueSql: "('-')"),
|
||||
installazione = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, defaultValueSql: "(N'SteamWare')"),
|
||||
licenza = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true, defaultValueSql: "('')"),
|
||||
numLicenze = table.Column<int>(type: "int", nullable: true, defaultValueSql: "((0))"),
|
||||
scadenza = table.Column<DateTime>(type: "date", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AnagKeyValue", x => x.idxLic);
|
||||
table.ForeignKey(
|
||||
name: "FK_AnagKeyValue_AnagApplicazioni",
|
||||
column: x => x.applicativo,
|
||||
principalTable: "AnagApplicazioni",
|
||||
principalColumn: "applicativo",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_AnagKeyValue_AnagInstallazioni",
|
||||
column: x => x.installazione,
|
||||
principalTable: "AnagInstallazioni",
|
||||
principalColumn: "installazione",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Permessi2Funzione",
|
||||
columns: table => new
|
||||
{
|
||||
COD_PERMESSO = table.Column<string>(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false),
|
||||
COD_FUNZIONE = table.Column<string>(type: "nvarchar(31)", maxLength: 31, nullable: false),
|
||||
READWRITE = table.Column<string>(type: "char(1)", unicode: false, fixedLength: true, maxLength: 1, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Permessi2Funzione", x => new { x.COD_PERMESSO, x.COD_FUNZIONE });
|
||||
table.ForeignKey(
|
||||
name: "FK_Permessi2Funzione_Permessi",
|
||||
column: x => x.COD_PERMESSO,
|
||||
principalTable: "Permessi",
|
||||
principalColumn: "COD_PERMESSO",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LicenzeAttive_applicativo",
|
||||
table: "LicenzeAttive",
|
||||
column: "applicativo");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LicenzeAttive_installazione",
|
||||
table: "LicenzeAttive",
|
||||
column: "installazione");
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using LiMan.DB.DatabaseModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace LiMan.DB.Migrations
|
||||
{
|
||||
[DbContext(typeof(LicManContext))]
|
||||
partial class LicManContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.10")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagApplicazioni", b =>
|
||||
{
|
||||
b.Property<string>("Applicativo")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("applicativo");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("descrizione");
|
||||
|
||||
b.HasKey("Applicativo");
|
||||
|
||||
b.ToTable("AnagApplicazioni");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagInstallazioni", b =>
|
||||
{
|
||||
b.Property<string>("Installazione")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("installazione");
|
||||
|
||||
b.Property<string>("Contatto")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("contatto");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("descrizione");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("email");
|
||||
|
||||
b.HasKey("Installazione");
|
||||
|
||||
b.ToTable("AnagInstallazioni");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.LicenzeAttive", b =>
|
||||
{
|
||||
b.Property<int>("IdxLic")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("idxLic")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Applicativo")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("applicativo")
|
||||
.HasDefaultValueSql("(N'-')");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("nvarchar(250)")
|
||||
.HasColumnName("descrizione")
|
||||
.HasDefaultValueSql("('-')");
|
||||
|
||||
b.Property<string>("Installazione")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("installazione")
|
||||
.HasDefaultValueSql("(N'SteamWare')");
|
||||
|
||||
b.Property<string>("Licenza")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("nvarchar(250)")
|
||||
.HasColumnName("licenza")
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
b.Property<int?>("NumLicenze")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("numLicenze")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
b.Property<DateTime>("Scadenza")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("scadenza");
|
||||
|
||||
b.HasKey("IdxLic")
|
||||
.HasName("PK_AnagKeyValue");
|
||||
|
||||
b.HasIndex("Applicativo");
|
||||
|
||||
b.HasIndex("Installazione");
|
||||
|
||||
b.ToTable("LicenzeAttive");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi", b =>
|
||||
{
|
||||
b.Property<string>("CodPermesso")
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("COD_PERMESSO");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("DESCRIZIONE");
|
||||
|
||||
b.Property<int?>("Gruppo")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("GRUPPO");
|
||||
|
||||
b.Property<string>("Nome")
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("NOME");
|
||||
|
||||
b.Property<int?>("Numero")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("NUMERO");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("varchar(250)")
|
||||
.HasColumnName("URL");
|
||||
|
||||
b.HasKey("CodPermesso");
|
||||
|
||||
b.ToTable("Permessi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi2Funzione", b =>
|
||||
{
|
||||
b.Property<string>("CodPermesso")
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("COD_PERMESSO");
|
||||
|
||||
b.Property<string>("CodFunzione")
|
||||
.HasMaxLength(31)
|
||||
.HasColumnType("nvarchar(31)")
|
||||
.HasColumnName("COD_FUNZIONE");
|
||||
|
||||
b.Property<string>("Readwrite")
|
||||
.HasMaxLength(1)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("char(1)")
|
||||
.HasColumnName("READWRITE")
|
||||
.IsFixedLength(true);
|
||||
|
||||
b.HasKey("CodPermesso", "CodFunzione");
|
||||
|
||||
b.ToTable("Permessi2Funzione");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.LicenzeAttive", b =>
|
||||
{
|
||||
b.HasOne("LiMan.DB.DatabaseModels.AnagApplicazioni", "ApplicativoNavigation")
|
||||
.WithMany("LicenzeAttives")
|
||||
.HasForeignKey("Applicativo")
|
||||
.HasConstraintName("FK_AnagKeyValue_AnagApplicazioni");
|
||||
|
||||
b.HasOne("LiMan.DB.DatabaseModels.AnagInstallazioni", "InstallazioneNavigation")
|
||||
.WithMany("LicenzeAttives")
|
||||
.HasForeignKey("Installazione")
|
||||
.HasConstraintName("FK_AnagKeyValue_AnagInstallazioni");
|
||||
|
||||
b.Navigation("ApplicativoNavigation");
|
||||
|
||||
b.Navigation("InstallazioneNavigation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi2Funzione", b =>
|
||||
{
|
||||
b.HasOne("LiMan.DB.DatabaseModels.Permessi", "CodPermessoNavigation")
|
||||
.WithMany("Permessi2Funziones")
|
||||
.HasForeignKey("CodPermesso")
|
||||
.HasConstraintName("FK_Permessi2Funzione_Permessi")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CodPermessoNavigation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagApplicazioni", b =>
|
||||
{
|
||||
b.Navigation("LicenzeAttives");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagInstallazioni", b =>
|
||||
{
|
||||
b.Navigation("LicenzeAttives");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi", b =>
|
||||
{
|
||||
b.Navigation("Permessi2Funziones");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user