Error Selecting Records with EntityFramework

0

Class that receives the query data

public class EngineEntity
    {

        public string FacturaId { get; set; }
        public string  Cliente { get; set; }
        public int? TipoFactura { get; set; }
        public double?  Monto { get; set; }
        public double? Impuesto { get; set; }
        public double? Total { get; set; }
        public string OrdenCompra { get; set; }
        public DateTime? Fecha { get; set; }
        public string Codigo { get; set; }
        public string Descripcion { get; set; }
        public double? Cantidad { get; set; }
        public double? Precio { get; set; }
        public double? SubTotal { get; set; }

    }

This is the method where I execute the query ... but in the WHERE it tells me that you can not implicitly convert the string type in Boolean What will I be doing wrong?

 public IQueryable<EngineEntity> FacturaInformacion(string FacturaId)
        {
            IQueryable<EngineEntity> valor;
            EMCEntities1 Modelo = new EMCEntities1();
            using (Modelo)
            {
               valor = from a in Modelo.FacturaDatos
                       join b in Modelo.FacturaDetail on a.FacturaId equals b.FacturaId where a.FacturaId = FacturaId
                       select new EngineEntity
                           {
                             FacturaId = a.FacturaId,
                             Cliente = a.Cliente,
                             TipoFactura = a.TipoFactura,
                             Monto = a.Monto,
                             Impuesto = a.Impuesto,
                             Total = a.Total,
                             OrdenCompra = a.OrdenCompra,
                             Fecha = a.Fecha,
                             Codigo = b.Codigo,
                             Descripcion = b.Descripcion,
                             Cantidad = b.Cantidad,
                             Precio = b.Precio,
                             SubTotal = b.SubTotal
                          };
            }
            return valor;
        }
    
asked by Efrain Mejias C 29.10.2016 в 14:37
source

2 answers

1

It is that you are using the assignment operator (=), not the comparison operator (==). The clause Where receives an expression tree with a Func delegate, that's why the comparison can be made. Just fix the sign and that's it.

    
answered by 31.10.2016 / 13:30
source
2

Try changing the end of the where of your clause where by this:

where a.FacturaId == FacturaId

And if it does not work for this:

where a.FacturaId equals FacturaId

If it does not work, tell me to see if I see any other solution.

    
answered by 29.10.2016 в 16:56