How to query Code First entities based on rowversion/timestamp value?

前端 未结 10 1173
忘了有多久
忘了有多久 2020-12-14 17:56

I\'ve run into a case where something that worked fairly well with LINQ to SQL seems to be very obtuse (or maybe impossible) with the Entity Framework. Specifically, I\'ve g

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 18:29

    You can use SqlQuery to write the raw SQL instead of having it generated.

    MyContext.Foos.SqlQuery("SELECT * FROM Foos WHERE Version > @ver", new SqlParameter("ver", lastFoo.Version));
    

提交回复
热议问题