All Questions
Tagged with linq entity-framework-6
964
questions
0
votes
1
answer
73
views
How can I search for a DATE in Entity Framework
I'm trying to get a date from my database and I've tried different things, but nothing seems to work.
This is my date in the database 2024-04-18 19:47:36.337, it's defined as datetime in Microsoft SQL ...
0
votes
0
answers
30
views
Detect EntityState of ALL included entities in Entity Framework query
I have a Linq query which returns related data with the .Include() method from Entity Framework (see below). My question is how would I get the EntityState of both the Companies and Addresses from ...
-1
votes
2
answers
52
views
Converting SQL to LINQ with Min and Max functions
I have the following SQL snippet that I am trying to convert to a LINQ query as part of a more complex query but I cannot see how to get started:
SELECT
AT.PrimaryIDChanged AS PID,
MAX(AT....
0
votes
1
answer
44
views
Unable to use simple function in Linq-to-entities query
I have lots of tabular data that needs to be filtered, filtering is supposed to be available for each column in the data. The data is simple types, int, double, string, bool, date. Users specify the ...
0
votes
1
answer
44
views
How can I replicate the functionality of IgnoreQueryFilter() in EF6?
I'm currently involved in a legacy ASP.NET MVC 5 project utilizing EF 6. The project demands the selective exclusion of a global filter in certain actions to retrieve soft-deleted data. While ...
-1
votes
1
answer
47
views
Using "Remove" in LINQ with Entity Framework 6 causing compile error
This method is not compiling and I don't seem to be able to find good fix.
The goals is to delete all rows from the "Period Table" called tblPeriods that have a StartDate greater than or ...
0
votes
0
answers
43
views
What is the best way to tune LINQ with pagination and order by? [duplicate]
I have a nullable column in my SQL Server table, let's say SomeDate. My objective is to get the rows where SomeDate is not null, then order by that same column and use pagination.
Here are sample rows:...
0
votes
0
answers
36
views
Linq Where -> Any on non-primitive object collections? [duplicate]
So I've noticed that we have a ton of database calls and trying to reduce them to a minimum, but I ran into issues attempting it.
How I've normally done it:
List<ItemData> itemData = new List<...
0
votes
1
answer
40
views
How to write new linq provider
I need to write the UT for async method, I am using EF6. Then I have the error: "the source 'iqueryable' doesn't implement 'iasyncenumerable moq".
I search on stackoverflow and found that ...
1
vote
1
answer
147
views
How to prevent inserting the same record in M-M relationship?
I have three EF classes M-M relationship, configured like this:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
// Configure many-to-many relationship between ExpertisePlan ...
0
votes
1
answer
28
views
I want to join three tables using LINQ query at present i am hitting DB three times to get the result
var user = await _userManager.FindByEmailAsync(request.Email);
var Menuss = await _context.MenuPermissions
.Where(x => x.UserId == user.Id && x.IsHide==false)
.Select(x => x....
-1
votes
1
answer
38
views
Pick the child dates closest to parent dates
Rules for picking the children to parent:
Parent can have 0 to any number of child
Children pay date always lesser than the parent dates
When opening any parent the child dates must be closest to ...
0
votes
1
answer
60
views
Issue translating method reference to SQL EF 6
I'm facing a problem when trying to translate a method reference to SQL in a LINQ to SQL query. Here's a simplified code snippet to illustrate the issue:
public class Entity
{
public int Property {...
0
votes
0
answers
842
views
Unable to update Data using EF Executeupdate and savechangesmethod
I am trying to update a single property from the filteredData result .filteredData contains more than one records and want to update IsActive property to False. I have tried to update using EF 7 ...
0
votes
0
answers
63
views
How to iterate Select and add index without AsEnumerable/Select((q, index))
I take a list of records from DB, which I need to paginate later, but filter before. Somethings like this:
... // I'm inside another .Select()
PaymentsReceived = p.ActivityPayments.Select(q => ...