c# - how to use canonical functions in Entity Framework and Mysql -


i want add timespan datetime in entityframework mysql database.

i have tried using dbfunctions.addminutes(someminutes) , entityfunctions.addminutes(someminutes) when execute exception

function projectname.addminutes not exist

i have googled cannot find how execute canonical function. though there list of function again don't know class belong https://msdn.microsoft.com/en-us/library/bb738563.aspx

i using

  1. mysql.data.entities 6.8.3.0
  2. entityframework 6.0.0
  3. mysql.data 6.8.4
  4. mysql.web 6.8.4
  5. mysql (database) 5.6.17

my linq query below

iqueryable<orderviewmodel> orders = _dbcontext.orders                          .orderbydescending(x => x.id)                          .select(x => new orderviewmodel                                          { id = x.id,                                           addedon = dbfunctions.addminutes(x.addedon, diffminutes).value,                                            customer = (x.isguestcheckout == true ? x.customeremail : x.customer.firstname + " " + x.customer.lastname),                                            phone = x.phone,                                            totalamount = x.totalamount,                                            orderstatus = x.orderstatus }); 

down road condition , pagination applied

actually misunderstood error not

function projectname.addminutes not exist

but

function databasename.addminutes not exist

i don't know issue is. have non-compatible driver/connector , don't know.

to solve problem created function name addminutes, calls date_add() function internally. function definition below

create function `addminutes`(actualdatetime datetime, minutestoadd int) returns datetime begin     return date_add(actualdatetime, interval minutestoadd minute); end 

i understand not proper solution, hack


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -