I am trying to access Oracle database using EF Core 6. But the database user given to me doesn’t have any database table. Instead I can see and modify another database user’s tables via SQL DEVELOPER. For example; my user: my user Other user: IFSAPP the following query While returning me a result, does not return any results. With EF
Tag: entity-framework-core
EF Core transaction lifetime
We are using our select statement inside transaction scope because of concurrency concerns. The question is, if I put my transaction in using statement, do I still have to call Commit() method explicitly to be sure that the transaction is closed or Dispose() method will do the job? Here’s example code: Answer The official docs would be your best friend
Get different results with the same query in T-SQL and LINQ (EF Core)
I’m trying to retrieve records from a database in Azure and for the checks I run T-SQL queries directly and then pass them to LINQ against the EF Core context, but I’m running into this problem. When I filter for the records with FechaOrientativa greater than or equal to Today, the Estudiar field is equal to ‘pt’, I get 2,296
Unable to make raw SQL calls from Entity Framework Core
I am working on a project where I am moving specific rows from a table between multiple different environments. The table has an Identity column and when I try to move it I get an error that Identity_Insert is off. Looking at several of the questions on here one of the solutions has been to call Context.Database.ExecuteSqlCommand(), ExecuteSqlRaw() or the
The LINQ expression could not be translated. Translation of method failed
I want to return list of ItemNos (string), even if few characters match and even if characters match in different place. For eg: If I pass in “appl” or “apole” or “daple”. I want DB to list “apple”. Tried using levenshteinDistance: (Checking for strings with less than 2 edit). Calling Compute method for finding edit distance – using this link
“Buy Items” with SQL Transaction in EF Core, if user send many requests, items are bought even if they can’t afford it
I’m trying to make a game where the user can buy items with ingame coins. The coins and the items are stored in a SQL database, and user should (obviously) only be able to buy items that they can afford. The Problem with this code is that if the user spams many requests at the same time, he gets more
How to write just one query to divide result from 2 query?
I have a query in Entity Framework Core like below: I am dividing one currencyRate to another from 2 queries. There are 2 select queries. Only difference between queries is where condition. How to do this in one select query? Answer Pull both rows with Put an explicit order by on like Now you know the two rows you get
Different performance from SQL Server query from Management Studio vs EF Core 5
I wrote a simple EF Core query that makes a select on a table using some where clause to filter data: start date and finish date between the actual date and a field (DescrizioneCommessa) containing a value. To get the raw SQL I just execute the statement: And the resultant query is: I notice that it takes very long to
Populate a List in one entity using information stored in a different table using EF Core 5
Summary I have two tables, a Users table and a Sponsorships table. The Sponsorships table has two foreign keys to the Users table. The relationship here is that a user can be sponsored by a several different users, and a user can sponsor several different users. I want to use this information to fill a list of Sponsors for each
In entity framework core, how we can set relationship for a table, when two fields is mapping to primary key of the another table
In entity framework core, how we can set relationship for a table, when two fields is mapping to primary key of the another table. For example I have two table namely Users & CashBox. Users Table Field Value UserId int UserName string CashBox Table Field Value CashBoxId int ActivatedBy int DeactivatedBy int In this case, activatedby & deactivatedby has to