EF - A member of the type, 'X', does not have a corresponding column in the data reader with the same name

0

Good,

I'm using EntityFramework to pass the result of this query:

SELECT a.* FROM [Logística$Sales Invoice Header] AS a INNER JOIN [Logística$Sales Invoice Line] AS b ON a.No_ = b.[Document No_] WHERE 1 = 1 AND b.Type = 2 AND a.[Bill-to Customer No_] = 'IC00029' AND b.No_ = 'XFMR2812B' AND b.[Cross-Reference No_] = '20M39' AND a.[Document Date] >= CONVERT(datetime, '02/01/2018', 103) AND a.[Document Date] <= CONVERT(datetime, '01/02/2018', 103)

for an instance of the Logistics_Sales_Invoice_Header class. This class was created using EntityFramework (Code-first).

However, it gives me the following error:

The data reader is incompatible with the specified 'FAMO.BaseItems.Database.urano.famNAV.Logística_Sales_Invoice_Header'. A member of the type, 'Sell_to_Customer_No_', does not have a corresponding column in the data reader with the same name.

When the column exists in the class declaration:

namespace FAMO.BaseItems.Database.urano.famNAV
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;

[Table("Logística$Sales Invoice Header")]
public partial class Logística_Sales_Invoice_Header
{
    [Column(TypeName = "timestamp")]
    [MaxLength(8)]
    [Timestamp]
    public byte[] timestamp { get; set; }

    [Key]
    [StringLength(20)]
    public string No_ { get; set; }

    [Column("Sell-to Customer No_")]
    [Required]
    [StringLength(20)]
    public string Sell_to_Customer_No_ { get; set; }

What could it be?

    
asked by anonymous 01.02.2018 / 11:40

0 answers