entity framework - Select last inserted ten rows -


i using entity framework. want inserted (means last ten) ten rows. table user has 2 columns:

userid password datetime 

how can recent ten rows?

if have datetime (or date) column can use this:

using(yourdbcontext ctx = new yourdbcontext()) {    var lasttenrows = ctx.users.orderbydescending(u => u.datetimecolumn).take(10).tolist(); }  

Comments