37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
|
|
// 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)");
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|