c# - How to compare minutes portion only of a TimeSpan in LINQ to Entities? -


i have publication entity in model. want retrieve publications created less 10 minutes now.

var publications = myentities.publications.     .where(p => p.creationuserid == exampleid              && (datetime.now - p.creationdate).minutes < 10); 

trying execute above statement, following exception: "dbarithmeticexpression arguments must have numeric common type.". tried appropriate function dbfunctions class, without success. can come solution this?

ok got skeeted add conversation , bit may useful others...

the method looking dbfunctions.diffminutes. gives total number of minutes between 2 values.

var publications = myentities.publications.     .where(p => p.creationuserid == exampleid              && dbfunctions.diffminutes(p.creationdate, datetime.now) < 10); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -