oh hell no

This commit is contained in:
fedpo
2024-09-08 18:46:32 +01:00
parent 393caac989
commit e3fd07a90a
105 changed files with 5743 additions and 232 deletions

View File

@@ -18,10 +18,16 @@ public class Context : Microsoft.EntityFrameworkCore.DbContext
public DbSet<ProductoNoPercedero> ProductoNoPercederos { get; set; }
public DbSet<Proveedor> Proveedores { get; set; }
public DbSet<Remito> Remitos { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ // Esto de poner credenciales sueltas está mal
optionsBuilder.UseSqlServer(@"Server=fedesrv.ddns.net,1433;Database=ControlStockDAS;User Id=ProyectoDas;Password=<IL-:aQI?TK{uRw:AU>A?5?~*=Gux'}JT0me,z5Cf^f(s'-gy[G#-jt%b&uHe+/,$Gl>qkXl-c[@&e(\.V?[3)\w|aMH+<GnkIo*99MNJ}:L=j<T,^$`8J\dXw6>^67x;Trusted_Connection=False;Encrypt=False;Connection Timeout=5;");
{
var homeDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
// Definir la ruta completa del archivo SQLite en el directorio del usuario
var dbPath = System.IO.Path.Combine(homeDirectory, "app.db");
// Configurar SQLite con la ruta a la base de datos en el directorio del usuario
optionsBuilder.UseSqlite($"Data Source={dbPath}");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
@@ -128,13 +134,15 @@ public class Context : Microsoft.EntityFrameworkCore.DbContext
j => j.HasOne<Categoria>().WithMany().HasForeignKey("CategoriaId"),
j => j.HasOne<Producto>().WithMany().HasForeignKey("ProductoId"),
j => j.HasKey("CategoriaId", "ProductoId"));
});
});
// Mapeo para ProductoNoPercedero
modelBuilder.Entity<ProductoNoPercedero>(entity =>
{
entity.Property(e => e.TipoDeEnvase)
.HasConversion<string>();
entity.Property(p => p.TipoDeEnvase)
.HasColumnType("TEXT");
});
modelBuilder.Entity<Proveedor>(entity =>
@@ -164,7 +172,7 @@ public class Context : Microsoft.EntityFrameworkCore.DbContext
.HasKey(df => new { df.Id, df.IdOrdenDeCompra });
modelBuilder.Entity<OrdenDeCompra>()
.HasKey(x => x.Id);
.HasKey(x => x.Id);
modelBuilder.Entity<OrdenDeCompra>()
.HasMany(x => x.detalles)