Entity Framework. View return duplicate records

前端 未结 5 1214
面向向阳花
面向向阳花 2020-12-04 15:26

I use Entity Framework that contains view. And I have query:

var data = this.context.vwRevenues
    .Where(x => x.revenue >= 0);
    .OrderByDescending         


        
5条回答
  •  失恋的感觉
    2020-12-04 16:10

    If you don't want to update edmx and set any key to column &&

    if you don't want to update view record (only for get record) then use below code its working for me.

    context.viewname.MergeOption = System.Data.Objects.MergeOption.NoTracking;
    
    context.viewname.Where(x => x.columnname != null);
    

提交回复
热议问题