I am working with Entity Framework. I have a class Compra
, when I put a read-only property, what function does it have? Does it come as a property in memory? Is it no longer in the map that is done with the fluent api?
I'm working with Code-First. I show the class below:
public class Compra
{
public Compra()
{
this.DetalleCompras = new List<DetalleCompra>();
}
public int CompraId { get; set; }
public string NumeroDocumento { get; set; }
public int ProveedorId { get; set; }
public int TipoComprobanteId { get; set; }
public EnumTipoMoneda TipoMoneda { get; set; }
public int SolicitudOrdenId { get; set; }
public int CondicionPagoId { get; set; }
public DateTime FechaEmision { get; set; }
public string GuiaRemision { get; set; }
// public decimal Total { get; set; }
public decimal Total
{
get { return this.DetalleCompras.Sum(x => x.Precio * x.Cantidad); }
}
public virtual Proveedor Proveedor { get; set; }
public virtual TipoComprobante TipoComprobante { get; set; }
public virtual SolicitudOrden SolicitudOrden { get; set; }
public virtual CondicionPago CondicionPago { get; set; }
public virtual ICollection<DetalleCompra> DetalleCompras { get; set; }
public virtual ICollection<PagoProveedor> PagoProveedores { get; set; }
}