All Questions
Tagged with linq linq-method-syntax
39 questions
0
votes
0
answers
57
views
C# Table query using GoupBy based on maximum version value in Linq Method
I have a table called "TB_USER_ROUTE" in which when I want to consult the information it shows the following result.
+------------+----------------------+--------------------+------------+---...
0
votes
2
answers
247
views
Calling query inside query in entity framework core
I want to do something like this
public string GetSiteTitleFromChangeHistory(int siteId)
{
var changeHistories = changeHistoryRepository.GetAll(c => c.SiteRegistryId == siteId);
var value = ...
0
votes
1
answer
103
views
How to distinct a duplicate row in EF Core 6 with method syntax?
I want to query my database where I am searching a contract id by grouping them with LcNoListId. It is possible to contains duplicate value in LcNoListId column against a contract id. At this point I ...
0
votes
0
answers
26
views
How to write Update logic using LEFT JOIN in LINQ Method Syntax?
In my .Net application, EntityFramework 6 is used and I am writing a logic in C# to update one of the column values of the ORDERTABLE to Yes or No.
In ORDERTABLE, for a Single TranID there will be one ...
0
votes
1
answer
599
views
How to join two tables and group by ID and count in LINQ C# method syntax
I have two tables:
PractitionerSkill { Id, Title }
PractitionerInSkills { Id, PractitionerSkillId ), where PractitionerSkillId is FK into PractitionerSkill
(there are more columns but that is not ...
0
votes
1
answer
472
views
How to Order Data Query in Entity Framework Table Relationships LINQ Method syntax?
I am having a problem ordering data by table Iscinstances row Name in table relationships, the Iscinstances table is JOIN in LinkUsersToIscinstances table, below is my query for the table ...
0
votes
1
answer
36
views
Get LINQ query Result with column value based on DateTime column
I have a table of machine details with one DateTime column in which I am entering the date and time of detail received for the corresponding machine.
Sample data is like this
MachineID X Y Z ...
-1
votes
2
answers
183
views
An exception occurred with using LINQ method syntax (LINQ to SQL) in C#
I use Linq to Sql and method syntax of Linq in my code to query from database with all tables. And I met an weird exception today, this is the first time error occurred since I started to use L2S.
...
0
votes
3
answers
847
views
Querying a Single Item in a List
Problem
I want to show a single pet on my details page. I'm having trouble understanding how to write LINQ(Method Syntax) to pull a single pet/item from the database.
My understanding so far
When ...
0
votes
2
answers
400
views
How to retrieve multiple column values with same foreign key id using Linq method Syntax in C#?
This works:
var query = (from user in _context.Users
join role in _context.UserRoles on user.UserID equals role.UserId
where user.Username == username
select ...
1
vote
3
answers
2k
views
C# LINQ, dynamic grouping by [Key] attributes
Consider the following classes:
public class Potato
{
[Key]
public string Farm { get; set; }
[Key]
public int Size { get; set; }
public string Trademark { get; set; }
}
public ...
0
votes
0
answers
817
views
Entity Framework Linq join method syntax
I have the following query which works fine
var aaa = from d in _context.SubCategories
join x in _context.CategoryLinks on d.ID equals x.SubCategoryID
where x.CategoryID == ...
1
vote
2
answers
71
views
GroupBy in List of items using LINQ
I have a list that contains item like below:
Now I want to group according to language index (Languages[x]) like below:
Group-1:
model.Languages[0].Employer
model.Languages[0].Title
Group-2:
model....
0
votes
2
answers
1k
views
Error: IAsyncEnumerable cannot be used for parameter of type IEnumerable on Entity framework
I've got these two LINQ expressions. I'm using Entity Framework. The only difference is the position of the items on the list of CardIds.
The first example returns the AdditionalCards that comes ...
1
vote
1
answer
607
views
Vb.net LINQ Syntax Group By Multiple Columns using Method Syntax
I have a LINQ expression that looks something like this
Dim DataRowDueTo = From row In DataTableDueTo.AsEnumerable
Where row.Field(Of UInt32)("Transaction") = 1 And {"A", "...