Questions tagged [dbfunctions]
28 questions
0
votes
1 answer
Migrating DBFunctions from Entity Framework 6 to Entity framework Core
I am migrating my .Net 6 Project from Entity framework 6 to Entity Framework Core and I need to replace the following code. How do I replace this Entity Framework 6 Sql TruncateTime Function with one that works with EF Core.
var result = db.Tickets
…

BoMerican
- 118
- 10
0
votes
1 answer
How to Compare two dates in LINQ in Entity Framework in .NET 5
using DbFunctions = System.Data.Entity.DbFunctions;
Using the above namespace I tried below ways but nothing worked.
This code is throwing an exception which states...
public async Task SomeFunction(){
var count = await…

Okasha Momin
- 191
- 3
- 15
0
votes
2 answers
Multi cursor in oracle function
I want to create an oracle function that get the user_id as param and return varchar2 that contain the e-mail text for the books that the user take from the library and didn't return them back, my email text that I want is:
"hello "
You should…

24sharon
- 1,859
- 7
- 40
- 65
0
votes
2 answers
DbFunctions or similar to compare time of day of a datetime type column in Linq to Entity Framework
I know there is a function to compare just the date of a datetime type column, but what if I want to only compare the time of it to another time. Is there a function in Linq To Entities?
DbFunctions.TruncateTime(q.EndDate.Value)

Mike Flynn
- 22,342
- 54
- 182
- 341
0
votes
1 answer
EF Core 3 DBFunction IQueryable return type
Does anyone know if it's possible to return anything other than a scalar value using a DBFunction declaration in EF Core?
I'm migrating a site to EFCore v3.1.1 from EF6 with SQL Server (from .Net Framework 4.7.2 to .Net Core 3.0). The SQL function…

Martin
- 3
- 1
- 2
0
votes
1 answer
How to convert this Query to Procedure?
I write following select query and it work find , and given out put.
Select custname,contactno, enc_dec.decrypt(creditcardno,password) as
creditcardno ,enc_dec.decrypt(income,password) as
income from employees where custid=5;
Now I need to …

uma
- 1,477
- 3
- 32
- 63
0
votes
1 answer
Using DbFunctions methods without installing Entity Framework nuget
I have a three tier ASP.Net Web application. The Data Layer has reference to EF and it contains all the repositories too. So I have installed EF nuget there.
Then I have a service layer to transfer data to and from data layer to views. Issue is,…

Garima
- 401
- 5
- 29
0
votes
0 answers
Entity Framework 6. Migration edmx DbFunctions to code first
We are migration from DataBase first approach to Code first for Entity Framework 6
We have model
public class Parent
{
public virtual int Id { get; set; }
public virtual DateTimeOffset DateFrom { get; set; }
public virtual…
0
votes
0 answers
Getting an exception while calculating difference between two dates in Linq
I am trying to get the duration between two dates in mysql.
I have observed that there is DbFunctions class which can calculate difference between two dates in different forms like days, hours, microseconds and many more.
I am using MySQL as…

Sandip D
- 103
- 1
- 14
0
votes
2 answers
Extend DbFunctions EF6
Is it possible to extend DbFunctions, assuming you are using existing DbFunctions as helper methods. I am essentially rewriting the exact same line of sql code again and again. Are there any alternatives?
Update:
Here is an example of what I'm…

TruthOf42
- 2,017
- 4
- 23
- 38
0
votes
1 answer
replace string with a db function in php
i want to replace a string with database function if it exists. i am using str_replace in following way but it doesn't work for me, this is returning $numOne as it was. i am beginner in php so help me
function…

Danish Bhatti
- 41
- 1
- 3
- 13
-1
votes
2 answers
Comparing dates in LINQ Entity Framework
I'm trying to run the following query:
List x =
_dbContext.EPCRA_Events
.Where(e => e.DueDt.HasValue &&
(e.DueDt.Value - DateTime.Now).Days < 30)
.ToList();
But I keep…

M. Rogers
- 367
- 4
- 18
-2
votes
1 answer
DbFunction.DiffMinutes { 'System.NotSupportedException' }
I want write this code
this part of my code
var today = DateTime.Now;
var todayString = today.ToShortDateString();
List fBList = _context.FBs.ToList();
fBList = fBList.Where(x => DbFunctions.DiffMinutes(x.FB_CDate, x.FB_LTDate) >…

Alireza heidari
- 45
- 7