Category "linq"

C# MongoDB Driver 2.15.0 unable to execute In Query with Linq

I am trying to get my resultset from MongoDB. I need to use In filter here. Here is my code that tries to get data. IMongoCollection<VaersVax> vaersVaxCol

C# linq remove duplicates from the top and bottom of the list and keep the duplicates in the middle

C# linq remove duplicates from the top and bottom of the list and keep the duplicates in the middle For example, var myArray = new[] { 1, 1, 2, 2, 3, 4,

How to retrieve firstordefault from a ToList in linq

I have the following table in sql I am trying to select all records with a status of onboard, but however you can see thatfor user '43d658bc-15a7-4056-809a-5c

Check if list of string contains exact part of string

I have a List of strings as follows, List<string> str = new List<string>() { "7, 31", "2, 4", "5, 6" }; My input will be something like "1, 2" or

Using join method on Entity Framework cause trouble

I got this error An unhandled exception of type 'System.StackOverflowException' occurred in EntityFramework.dll when I use join for listing data from the data

Select the max,min of nested lists vb.net

I have these objects Public Class Class1 Public Property Type As String Public Property SpecLimits As Limits End Class Public Class Lim

Add one object in list nested entity in EF Core

I create a repository layer in my app. I don't need all list EntityList. I want add in Foo.EntityList 1 object which equals entityId, and return foo in notImpor

C# find JSON value based only on Key name through multiple levels of array

I have a variety of input JSON formatted data which all contain a particular key-name terminalSize. This is the only piece I know. The total number of JSON tree

In Entity Framework Core 3.1, what is the best way to dynamically provide table name to a query?

I have seen options for .NET 5, .NET Core 2.0, etc. but none of them seem to work for .NET Core 3.1 What is the best way to provide table name, in a variable, t

Using linq to return records from sql server based on users datetimeoffset

I have a dateTime offset value that gets passed from the UI which looks like startDate:2022-04-25 21:08:02.2973333 +00:00 but the date i entered is actually the

Using SelectMany on IQueryable vs IEnumerable

I wanted to do a little experiment to see the cost of operations if I process the data at CosmosDB and return it, vs. if I read the whole document and process i

LINQ to SQL, 'Linq' does not exist in the namespace 'System.Data'

I tried to connect my project to a database, using LINQ to SQL, following a few online guides. I created a simple database Library, added new LINQ to SQL Classe

LINQ select column that contains some array element

I have a field "details" varchar(MAX) in my table with the detailed description of an item, I need to select the records that contain the keywords passed by the

Is Using EF Core Value Converter Preventing the Contains() LINQ Method from being Translated to SQL?

I have a Movie class. It has a Genres property of type List<string>. I use this exact EF Core Value Conversion to store it in the database as a comma-sepa

If it possible accelerate From-Where-Select method?

I have two var of code: first: struct pair_fiodat {string fio; string dat;} List<pair_fiodat> list_fiodat = new List<pair_fiodat>(); // list filled

Using Asp.Net Core Viewbag

Layout.cshtml @{ var menus = (IEnumerable<WebApplication.Models.TopMenu>)ViewBag.menus; } <div class="col-md-8"> <!-- Menu Partia

C# LINQ Filter records in child tables

I have a main table "SALES" and two secondary tables "PRODUCTS" and "SERVICES", I need to select only the records in "SALES" that contain some product or servic

Using C# LINQ with MongoDB Find

I am only about 3 days into using MongoDb and C# driver so be gentle. ;-) I have a MongoDB query working with AsQueryable. I would like to use the collection.Fi

Looping through multiple collection of arrays

I have a lot of data as response not parsed and also, so you can see what is in the response. But I want all the scores from the table results, the query filter

How to merge two lists using LINQ Suming especifics fields with sublists

Considering I have 2 list (listaProduto1 and listaProduto2), both with same properties, but with different values. I need the result merge both lists, but it mu