Init Commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// Backend/MotoresArgentinosV2.Infrastructure/Data/InternetDbContext.cs
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MotoresArgentinosV2.Core.DTOs;
|
||||
|
||||
namespace MotoresArgentinosV2.Infrastructure.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Contexto de Entity Framework para la base de datos Internet (legacy)
|
||||
/// Servidor: ...
|
||||
/// Base de Datos: internet
|
||||
/// Propósito: Acceso a datos de avisos web
|
||||
/// </summary>
|
||||
public class InternetDbContext : DbContext
|
||||
{
|
||||
public InternetDbContext(DbContextOptions<InternetDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
// Registrar el DTO como entidad sin llave (Keyless) para que SqlQueryRaw funcione bien
|
||||
modelBuilder.Entity<DatosAvisoDto>(e =>
|
||||
{
|
||||
e.HasNoKey();
|
||||
e.ToView(null); // No mapea a tabla
|
||||
|
||||
// Configurar precisión de decimales para silenciar warnings
|
||||
e.Property(p => p.ImporteSiniva).HasColumnType("decimal(18,2)");
|
||||
e.Property(p => p.ImporteTotsiniva).HasColumnType("decimal(18,2)");
|
||||
e.Property(p => p.PorcentajeCombinado).HasColumnType("decimal(18,2)");
|
||||
e.Property(p => p.Centimetros).HasColumnType("decimal(18,2)");
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user