Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
0 votes
2 answers
84 views

I am trying to convert SQL to Linq that flattens two related tables into one record per parent table row (opposite of SelectMany). My first attempt is below, but the resulting SQL is different ...
Zachary Scott's user avatar
0 votes
1 answer
39 views

I am trying to join to tables together in vb.Net using linq to return the distinct count of the primary keys, and I can't quite seem to get the syntax Here's the code to create the tables Dim ...
josmond's user avatar
  • 17
1 vote
1 answer
35 views

I'm using automapper for a dynamic query and it's working well until I use an orderby clause. So this is how I create the query: IQueryable<DTOFormCellSouches> query; //Configuration de l'...
CaptnKebec's user avatar
1 vote
3 answers
64 views

I have the following source as XML: <?xml version="1.0"?> <report> <feature tag="Config"/> <feature tag="Runtime"> <feature tag=...
Mark Mullen's user avatar
1 vote
2 answers
63 views

As source I have a XML document with the following content: <?xml version="1.0"?> <report> <feature tag="Config"/> <feature tag="Runtime"> ...
Manfred Singer's user avatar
1 vote
1 answer
81 views

I have a collection of UserTaskGroup as List, in which each UserTaskGroup object have a List in it, means for 1 task group, there could be one or more tasks. And UserTask class has a field named ...
AbdulAleem's user avatar
0 votes
2 answers
124 views

I never used LINQ but now I have to and I'm having a bit of trouble with it. Below is an example of how I would normally compare two lists and retrieve the bad and good price records. How can I do the ...
Belmiris's user avatar
  • 2,815
-1 votes
2 answers
96 views

How can I update the following approach using linq to update a loop within a loop, and having two conditions? I've looked at other posts that are similar but not with two conditions. foreach (var ...
MarioSalento's user avatar
2 votes
1 answer
129 views

I have the following class class Person { public required string Name { get; set; } public required string Lastname { get; set; } public override string ToString() => $"{Name} - {...
user19291301's user avatar
-1 votes
2 answers
200 views

To optimize the performance of a C# application and came across AsParallel() in LINQ. I want to understand the key differences between them, especially regarding performance when working with larger ...
Yassine Zakhama's user avatar
2 votes
2 answers
176 views

Let's have a phone book: "John" ---> 6463 "Andrea" ---> 1234 "Michael" ---> 2611 "Irene" ---> 6463 "Matthew" ---> 7699 Notice that ...
Pavel Foltyn's user avatar
2 votes
1 answer
62 views

I am writing a library function to split an enumeration into multiple spans of enumerations but am running into an inexplicable issue with the enumerator from linq Select clause. Please see ...
JohnC's user avatar
  • 367
0 votes
2 answers
106 views

I don't know what i miss. I used it thousands of time and I updated millions of rows before. There are two tables. One is storing definitions. One is storing relations years based. Some relations are ...
Hakkı's user avatar
  • 837
-1 votes
2 answers
184 views

I have C# application (.NET Core 4) and I have written the following LINQ expression for getting list of assigned tickets from database view. public async Task<List<TicketSchedulerDTO>> ...
Prashil Shah's user avatar
2 votes
1 answer
55 views

XML: <DLC> <ObjectClass>RVM_GWR_Class166_DMSL_C</ObjectClass> <ShortName>Class166</ShortName> </DLC> <DLC> <ObjectClass>...
Dan Sewell's user avatar
  • 1,310
-1 votes
2 answers
95 views

I have the following LINQ query: var resultData = from audit in _context.audittable join region in _context.Regions on audit.RegionCode equals region.RegionCode ...
Farhin Shaikh's user avatar
2 votes
2 answers
110 views

I have List<User> with this dependencies: class User { public string Id { get; set; } public List<ManagerGroup> ManagerGroups { get; set; } } class ManagerGroup { public string ...
Nick ANV's user avatar
0 votes
1 answer
63 views

I'm trying to write a "relaxed" comparison method which operates on Expressions and is used in Entity Framework. It consists of a chain of Replace() calls and ToLower() to perform an inexact ...
Daniel Vernall's user avatar
0 votes
2 answers
150 views

This is the error I'm getting when I trye to execute the code.(https://i.sstatic.net/Z2MVQ0mS.png) Error message: Incorrect syntax near the keyword 'AND'. StackTrace: at Microsoft.Data.SqlClient....
Menake Panduwawala's user avatar
1 vote
2 answers
99 views

I'm working on a LINQ query where I need to select values from a data source based on the value of an enum (ConversationRole). I want to return different user IDs based on whether the ConversationRole ...
Rodrygo's user avatar
  • 21
0 votes
0 answers
58 views

I have 3 tables in postgres DB (docker postgres:14.1-alpine). public class House { public Guid Id { get; set; } public virtual ICollection<Flat> Flats { get; set; } public ...
Romzes200677's user avatar
0 votes
1 answer
83 views

So I have a query to get a list of chats with 2 users (including their pictures) and the last message. An exception is thrown because of that last message sub-query: "The LINQ expression '...
Serhii Ka.'s user avatar
  • 2,064
1 vote
2 answers
285 views

I am working with the ABP Framework using C# and Entity Framework Core, and I have the following query: public async Task<ListResultDto<GetLinkedOrganizationsDto>> ...
Jesus's user avatar
  • 485
2 votes
2 answers
52 views

I want to split the items using Linq in such way that each time a command type changes the previous items go to a separate group. I tried to split using GroupBy but it just puts all items with same ...
theateist's user avatar
  • 14.5k
-2 votes
1 answer
70 views

I've got three collections with common key: var shops = new[] { new { shopId = "1", shopName = "shop1" }, new { shopId = "2", shopName = "shop2" } , new { ...
Артем Бахирев's user avatar
0 votes
1 answer
60 views

I am working on Odata API with .NET. I am facing an issue with the implementation of one of my endpoints. I have a nested array that is not being returned in the JSON response. The /software service ...
Malek Hammou's user avatar
0 votes
1 answer
66 views

How could I convert this query into Linq in C#? SQL query: SELECT * FROM com.DepartmentPersonnel q1 INNER JOIN (SELECT dp.DepartmentID, MIN(dp.JobTypeID)JobTypeID FROM com....
MHD's user avatar
  • 47
0 votes
1 answer
28 views

How to get parent model as a result. I want to get MasterData type as a result. i want to use where condition in Attributes but i want to receive Master Data Type as a result var result= MasterData....
namaste1968's user avatar
0 votes
0 answers
72 views

I am having an issue with the Linq Distinct Method. I have a List of LocationID's B A01A B A01A A A01A A A01A A A01A As you can see, there are only two distinct values here. However, When they are ...
Nasim Ahmed's user avatar
0 votes
1 answer
74 views

I have this code: List<int> cats = new List<int>(); foreach (var cat in ctx.TblCategories) { int catCount = ctx.TblProducts .Where(x => int.Parse( ...
redoc01's user avatar
  • 2,527
1 vote
1 answer
83 views

How to add an aggregate pipeline stage that will change the collection model output that the aggregation is being run on? X/Y question: How to aggregate lookup a document referenced as ObjectId in ...
GiBhu's user avatar
  • 25
2 votes
4 answers
254 views

This is hard to search for as a non-native English speaker, as any search terms I come up with results in lots of questions related to OrderBy(Descending), and not what I am after. Imagine I have a ...
Rune Jacobsen's user avatar
1 vote
1 answer
58 views

Trying to get values of some child elements in XML, however, when retrieving the values of these elements, they are stitched together. Also, sometimes the file can have 1 reference number but there ...
jwdickins's user avatar
0 votes
1 answer
112 views

In my .NET Core application using Entity Framework Core I was using SQL Server but am shifting to SQLite. In SQLite GUID type filters are returning null: public Guid GetAdminBranchId(Guid companyId) { ...
Zoraiz's user avatar
  • 23
0 votes
1 answer
59 views

I have a big question about the use of conditions in group joins using Dynamic Linq Query syntax. I have the following code, which I am using to generate a left join code. result = result.AsQueryable()...
Sergio Marchant's user avatar
0 votes
1 answer
89 views

The following method works perfectly with SQL Server, no issues. public async Task<IEnumerable<HashRecord>> GetLatestHashes(long jobId, CancellationToken token) { var context = ...
JaimeCamargo's user avatar
1 vote
1 answer
102 views

I am trying to write a linq query against the Mongo DB C# driver in order to pull back documents from a collection where they do not have a corresponding related record in another collection. A is an ...
David Hirst's user avatar
  • 2,032
1 vote
2 answers
167 views

Given request.Order type is ColumnName[]. I'm trying to write a one line piece of code equivalent to this incorrect code: request.Order.FirstOrDefault(x => x.Name == "From").Name = "...
Diego Perez's user avatar
  • 3,034
-1 votes
2 answers
91 views

I have SQL query where I subgroup 4 items before final grouping. Here is the SQL query : Select DISCIP, SUM(TOTAL) as TOTAL, SUM(COMP) as DONE, SUM(...
Hussein's user avatar
  • 1,001
-3 votes
1 answer
124 views

Disclaimer - This is both a theoretical and real case question. Legacy and other circumstances makes it real. The question is: Can I force EF6 to use VARCHAR instead of NVARCHAR in QUERY expressions? ...
kristoffer_o's user avatar
0 votes
1 answer
80 views

I want to convert this sql query to LINQ left join @categories oc on OC.course_id = t.course_id and isnull( t.offlinecategory_id,-1) = isnull(oc.offlinecategory_id,-1) I tried in ...
Lakshan's user avatar
  • 11
0 votes
0 answers
66 views

I've a list of class containing different type of properties: public class Test { public string grade { get; set; } public int minVal { get; set; } public int maxVal { get; set; } } ...
Osama Rizwan's user avatar
0 votes
1 answer
106 views

I need to group transaction by its CreatedAt property. But in the specific timezone. Like this SELECT SUM("Amount") FROM public."Transactions" GROUP BY CAST("...
Danyil Malko's user avatar
1 vote
1 answer
217 views

I have a list of English and Korean words that I am trying to order so that the Korean words are ordered first, with the English words being ordered last. This SO post is my exact issue: C# linq order ...
cameron2134's user avatar
0 votes
1 answer
58 views

Alright, so this is quite hard to explain, but I will do my best. I have a list filled with books. All of the books have variables such as Title, publishYear, and Author. But they also have Genres, ...
Christofer Carlsson's user avatar
0 votes
4 answers
278 views

Using Linq, you can iterate through a list, taking all items that meet a condition by using the Where method. However, I have a list in which I want to take all items that meet a condition and do one ...
ewok's user avatar
  • 21.7k
0 votes
2 answers
103 views

I've got a List<> in C# and I want to check that all elements of the list meet some condition. This condition depends on the element in the list, as well as that elements index in the list. It ...
beyarkay's user avatar
  • 1,173
8 votes
1 answer
308 views

I'm curious about the following: Why is EF Core unable to translate a static readonly ICollection<T> & static readonly IList<T> field into a query when using it inside of a .Contains()...
Tim Lange's user avatar
  • 101
0 votes
1 answer
49 views

I have this situation: SQL Server database used with EF Core (code-first strategy). I have an entity containing a boolean flag called Inactive - with the meaning: when TRUE, this entry is regarded as &...
user1608721's user avatar
-2 votes
3 answers
116 views

I have a method where I changed the endswith logic with a conditional base as follows from then it starts throwing the exception public async Task<IEnumerable<CorpTransaction_DTO>> ...
Developer's user avatar
  • 8,697