model articoli, dbcontext e collegamento su startup
This commit is contained in:
parent
a63eaa8281
commit
7949d5f5db
36
ApiPolo/Models/Articoli.cs
Normal file
36
ApiPolo/Models/Articoli.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
namespace ApiPolo.Models
|
||||||
|
{
|
||||||
|
public class Articoli
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public string Azienda { get; set; }
|
||||||
|
[Key]
|
||||||
|
public string SlCodice { get; set; }
|
||||||
|
public string? ArDesArt { get; set; }
|
||||||
|
public string? SlCodMag { get; set; }
|
||||||
|
[Column(TypeName = "decimal(13,3)")]
|
||||||
|
public decimal? SlQtAper { get; set; }
|
||||||
|
public string? AmCodice { get; set; }
|
||||||
|
public string? LoCodice { get; set; }
|
||||||
|
public string? LiCodLis { get; set; }
|
||||||
|
public string? LiCodArt { get; set; }
|
||||||
|
public DateTime? LiDatAtt { get; set; }
|
||||||
|
[Column(TypeName = "decimal(12,3)")]
|
||||||
|
public decimal? LiQuanti { get; set; }
|
||||||
|
[Column(TypeName = "decimal(18,5)")]
|
||||||
|
public decimal? LiPrezzo { get; set; }
|
||||||
|
[Column(TypeName = "decimal(6,2)")]
|
||||||
|
public decimal? LiScont1 { get; set; }
|
||||||
|
[Column(TypeName = "decimal(6,2)")]
|
||||||
|
public decimal? LiScont2 { get; set; }
|
||||||
|
[Column(TypeName = "decimal(6,2)")]
|
||||||
|
public decimal? LiScont3 { get; set; }
|
||||||
|
[Column(TypeName = "decimal(6,2)")]
|
||||||
|
public decimal? LiScont4 { get; set; }
|
||||||
|
public string? GestMatr { get; set; }
|
||||||
|
public string? GestLotti { get; set; }
|
||||||
|
public string? DescSup { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
27
ApiPolo/Models/VT_dbcontext/VT_ARTICOLI_TABLE_DbContext.cs
Normal file
27
ApiPolo/Models/VT_dbcontext/VT_ARTICOLI_TABLE_DbContext.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||||
|
|
||||||
|
namespace ApiPolo.Models.VT_dbcontext
|
||||||
|
{
|
||||||
|
public class VT_ARTICOLI_TABLE_DbContext : DbContext
|
||||||
|
{
|
||||||
|
public VT_ARTICOLI_TABLE_DbContext(DbContextOptions<VT_ARTICOLI_TABLE_DbContext> options) : base(options)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public DbSet<Articoli> Articoli { get; set; }
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<Articoli>().ToTable("Articoli");
|
||||||
|
modelBuilder.Entity<Articoli>().HasKey(Table => new
|
||||||
|
{
|
||||||
|
Table.Azienda,
|
||||||
|
Table.SlCodice
|
||||||
|
}); // Definizione della chiave primaria composta
|
||||||
|
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -740,6 +740,9 @@ namespace ApiPolo
|
|||||||
services.AddDbContext<VT_COMMESSE_APP_DbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("VIRTUAL_TASK")
|
services.AddDbContext<VT_COMMESSE_APP_DbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("VIRTUAL_TASK")
|
||||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
||||||
));
|
));
|
||||||
|
services.AddDbContext<VT_ARTICOLI_TABLE_DbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("VIRTUAL_TASK")
|
||||||
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
||||||
|
));
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region LIFT_WEB
|
#region LIFT_WEB
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user