Error to map in EntityFramework

1

Good,

I'm trying to map a database using the EntityFramework-Reverse-POCO-Code -First-Generator and one of my views has the following mapping:

public VIEW_CODE_NAV_CustomerLedgerEntryMapping(string schema)
{
    ToTable("VIEW_CODE_NAV_CustomerLedgerEntry", schema);
    HasKey(x => new { x.DocumentType, x.DocumentNo_, x.ExternalDocumentNo_, x.RemainingAmount_LCY_stats_, x.Amount_LCY_stats_, x.PostingDate, x.Open, x.CustomerNo_ });

    Property(x => x.DocumentType).HasColumnName(@"Document Type").HasColumnType("int").IsRequired().HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
    Property(x => x.DocumentNo_).HasColumnName(@"Document No_").HasColumnType("nvarchar").IsRequired().HasMaxLength(20).HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
    Property(x => x.ExternalDocumentNo_).HasColumnName(@"External Document No_").HasColumnType("nvarchar").IsRequired().HasMaxLength(35).HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
    Property(x => x.RemainingAmount_LCY_stats_).HasColumnName(@"Remaining Amount _LCY_ stats_").HasColumnType("numeric").IsRequired().HasPrecision(38,20).HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
    Property(x => x.Amount_LCY_stats_).HasColumnName(@"Amount _LCY_ stats_").HasColumnType("numeric").IsRequired().HasPrecision(38,20).HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
    Property(x => x.PostingDate).HasColumnName(@"Posting Date").HasColumnType("datetime").IsRequired().HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
    Property(x => x.Open).HasColumnName(@"Open").HasColumnType("tinyint").IsRequired().HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
    Property(x => x.CustomerNo_).HasColumnName(@"Customer No_").HasColumnType("nvarchar").IsRequired().HasMaxLength(20).HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);
}

However, when I go to test the application, I get this error:

The data reader is incompatible with the specified 'FAMO.BaseItems.Database.urano.CODE.VIEW_CODE_NAV_CustomerLedgerEntry'. 
A member of the type, 'DocumentNo_', does not have a corresponding column in the data reader with the same name.

Can someone give me a suggestion on what to do?

    
asked by anonymous 06.12.2018 / 17:01

0 answers