0
我很困惑,因为在使用实体框架中的原始SQL查询(请参见下面的屏幕截图)时,查询只返回一列中的不同数据。EF核心原始SQL(FromSql)查询返回不正确的数据?
正确的结果当然是直接从SQL Server查询数据库时得到的结果。
当然,我执行完全相同的查询,在相同的数据库和相同的服务器上。我正在寻找相同的专栏。
编辑: 这里是LigneFacture类:
public class LigneFacture
{
[Required]
public string Entite { get; set; }
public decimal NumFacture { get; set; }
[Required]
[StringLength(2)]
public string TypeTransaction { get; set; }
[Required]
public DateTime DateFacture { get; set; }
[StringLength(10)]
public string CodeClient { get; set; }
[StringLength(100)]
public string NomClient { get; set; }
[Required]
[StringLength(10)]
public string CodeProduit { get; set; }
[StringLength(150)]
public string NomProduit { get; set; }
[StringLength(10)]
public string CodeLabo{ get; set; }
[StringLength(150)]
public string Laboratoire { get; set; }
[Required]
[StringLength(25)]
public string Numlot { get; set; }
public DateTime Peremption { get; set; }
public decimal Quantite { get; set; }
public decimal ValeurHt { get; set; }
public decimal ValeurRz { get; set; }
public decimal ValeurTva { get; set; }
public decimal PuAchat { get; set; }
public decimal PuPpa { get; set; }
public decimal PuDemi { get; set; }
public decimal PuCess { get; set; }
//This field is causing the problem (it's declared as int in the database as well)
public int Ligne { get; set; }
public string HreString { get; set; }
public int AnneeTransaction { get; set; }
public int MoisTransaction { get; set; }
public decimal TauxRemise { get; set; }
public string Zone { get; set; }
public int Colis { get; set; }
}
值的其余部分是完全一样的。
什么是'LigneFacture' - 假实体类?我们可以看到它吗? –
是的,这是一个虚假的实体类。 – iMad
该“实体”的PK(我没有看到它的定义)是什么? –