bug fix e tentetivi seed data

This commit is contained in:
zaccaria.majid
2023-07-21 16:46:03 +02:00
parent 62b232b05e
commit 5be1aedd23
10 changed files with 1250 additions and 9 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>WebDoorCreator - Egalware</i>
<h4>Version: 0.9.2307.2109</h4>
<h4>Version: 0.9.2307.2116</h4>
<br /> Release note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
0.9.2307.2109
0.9.2307.2116
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>0.9.2307.2109</version>
<version>0.9.2307.2116</version>
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory>
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Data.DbModels
{
[Table("TestTable")]
public class IdentityTableSeedTest
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdUni { get; set; } = 0;
[MaxLength(50)]
public string Campo1 { get; set; } = "";
[MaxLength(500)]
public string Campo2 { get; set; } = "";
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebDoorCreator.Data.Migrations.WDCData
{
public partial class AddIdTestTable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TestTable",
columns: table => new
{
IdUni = table.Column<string>(type: "nvarchar(450)", nullable: false),
Campo1 = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Campo2 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TestTable", x => x.IdUni);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TestTable");
}
}
}
@@ -551,6 +551,27 @@ namespace WebDoorCreator.Data.Migrations.WDCData
b.ToTable("Hardware");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.IdentityTableSeedTest", b =>
{
b.Property<string>("IdUni")
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(450)");
b.Property<string>("Campo1")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Campo2")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.HasKey("IdUni");
b.ToTable("TestTable");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.LanguageModel", b =>
{
b.Property<string>("CodLingua")
+47
View File
@@ -0,0 +1,47 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using WebDoorCreator.Data.DbModels;
namespace WebDoorCreator.Data
{
public class TestConfiguration : IEntityTypeConfiguration<IdentityTableSeedTest>
{
#region Public Methods
public void Configure(EntityTypeBuilder<IdentityTableSeedTest> builder)
{
// Default seeded users
builder.HasData(
// SuperAdmins
getNewTestRec("zaccaria.majid@egalware.com", "th1sIsTh3R1vrOfThNgt98"),
getNewTestRec("samuele.locatelli@egalware.com", "th1sIsTh3R1vrOfThNgt96"),
// Admin
getNewTestRec("zaccaria.majid01@egalware.com", "th1sIsTh3R1vrOfThNgt94"),
getNewTestRec("zaccaria.majid02@egalware.com", "th1sIsTh3R1vrOfThNgt92")
);
}
#endregion Public Methods
#region Protected Fields
#endregion Protected Fields
#region Protected Methods
protected IdentityTableSeedTest getNewTestRec(string campo1, string campo2)
{
var newRec = new IdentityTableSeedTest
{
Campo1 = campo1,
Campo2 = campo2.ToUpper()
};
return newRec;
}
#endregion Protected Methods
}
}
+10 -5
View File
@@ -25,7 +25,7 @@ namespace WebDoorCreator.Data
try
{
// se non ci fosse... crea o migra!
//Database.Migrate();
Database.Migrate();
}
catch (Exception exc)
{
@@ -78,6 +78,7 @@ namespace WebDoorCreator.Data
public virtual DbSet<SerializedDoorsModel> DbSetSerializedDoors { get; set; } = null!;
public virtual DbSet<ConfigModel> DbSetConfig { get; set; } = null!;
public virtual DbSet<PrtRepOrderModel> DbSetPrtRepOrder { get; set; } = null!;
public virtual DbSet<IdentityTableSeedTest> DbSetIdentityTableSeedTest { get; set; } = null!;
#endregion Public Properties
@@ -119,7 +120,7 @@ namespace WebDoorCreator.Data
{
//// dev
//optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=WebDoorCreator;Trusted_Connection=True;", e => e.UseHierarchyId());
optionsBuilder.UseSqlServer("Server=SQL2016PROD;Database=DCA_WebDoorCreator;Trusted_Connection=True;", e => e.UseHierarchyId());
optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=WebDoorCreator;Trusted_Connection=True;", e => e.UseHierarchyId());
}
}
}
@@ -168,12 +169,16 @@ namespace WebDoorCreator.Data
modelBuilder.ApplyConfiguration(new LanguageConfiguration());
}
//this.Database.ExecuteSqlRaw("SET IDENTITY_INSERT [dbo].[TestTable] ON");
modelBuilder.ApplyConfiguration(new TestConfiguration());
//this.Database.ExecuteSqlRaw("SET IDENTITY_INSERT [dbo].[TestTable] OFF");
// modello dati x report ordini
modelBuilder.Entity<PrtRepOrderModel>().HasKey(c => new { c.OrderId, c.DoorId, c.ObjectKey});
modelBuilder.Entity<PrtRepOrderModel>().HasKey(c => new { c.OrderId, c.DoorId, c.ObjectKey });
//modelBuilder.Seed();
modelBuilder.Seed();
OnModelCreatingPartial(modelBuilder);
}
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>0.9.2307.2109</Version>
<Version>0.9.2307.2116</Version>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
</PropertyGroup>