Unbelievable duplicate in an Entity Framework Query

前端 未结 5 600
情书的邮戳
情书的邮戳 2021-02-07 11:40

My SQL query against a particular view returns me 3 different rows.

 select * from vwSummary
 where vidate >= \'10-15-2010\' and vidate <= \'10-15-2010\'
          


        
5条回答
  •  情话喂你
    2021-02-07 12:08

    I just experienced this issue and thought it was my implementation until I found this post. The only workaround I managed to get working was to actually run the sqlquery as follows:-

    using(var db = new Tpr.Models.MyContext())
    {
        var model = _uow._context.Database.SqlQuery(string.Format("select * from MyTable where ID = '{0}'", "12345678"));
    
        Assert.IsNotNull(model);
    }
    

提交回复
热议问题