Skip to main content

All Questions

Tagged with
0 votes
0 answers
94 views

Microsoft.Data.SqlClient.SqlError: Incorrect syntax near the keyword 'AND'

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
0 votes
1 answer
42 views

Why are my GUID type filters returning null?

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
  • 21
1 vote
2 answers
144 views

Shortest way to set a property after FirstOrDefault

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
  • 2,802
1 vote
1 answer
110 views

C# LINQ OrderBy with an explicit culture returns different results on different .NET versions

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
0 answers
25 views

Quirkiness of Blazor Server Apps deployed on Hosted IIS VM on Azure

I am posting this to help me understand what is happening behind the scene with my code in a Blazor Server Application. As mentioned, my Blazor Server App (the App here in after), is, at least to me, ...
Mariano's user avatar
  • 101
0 votes
1 answer
67 views

Detecting and casting Linq expressions accordingly

I wrote an extension method to make it easier to add multi-column indexes in EF 8 (.NET 8) as follows: public static IndexBuilder<TEntityType> HasIndexUnique<TEntityType> ( this ...
Raheel Khan's user avatar
  • 14.7k
0 votes
2 answers
48 views

CustomerResponse is duplicated for every address record

I have the following query: var query = from customer in _unitOfWork.customerRepository.All() join adresses in _unitOfWork.AdresRepository.All() on customer.adressNo equals adresses....
user3552264's user avatar
0 votes
1 answer
59 views

LINQ Subquery selects all columns instead of the specified only

I have the following LINQ query: var query = from store in _dbContext.Stores.AsNoTracking() join shelf in _dbContext.Shelves.AsNoTracking() on store.Id equals shelf.StoreId ...
cinosz's user avatar
  • 23
3 votes
3 answers
216 views

Filtering a List with other two Lists

Consider the following three example lists: List<string> localPatientsIDs = new List<string> { "1550615", "1688", "1760654", "1940629", "34277&...
fabricioLima's user avatar
0 votes
1 answer
48 views

Get DescriptionAttribute via reflection

I have this: public class Demo { [Description("Hello World!")] public int SomeProp { get; set; } } I want the description. So I wrote this: public string? GetDescription<TType, ...
lonix's user avatar
  • 19.6k
0 votes
0 answers
31 views

EF Core passing 0 as null for ID Column [duplicate]

I have a table with ID as primary key, which can have value 0 (obviously non-repeating). The Id column is not an identity column. While adding a record manually, SQL server allows me to store 0 in ID ...
Pankaj Kumar's user avatar
-1 votes
1 answer
57 views

Create a list of values based on a seed and the previous value

I have an object (a trigger) that contains a method called GetNextFireTime(DateTimeOffset after), which returns the next time the trigger will fire after the given input. My goal is, given an input ...
ewok's user avatar
  • 21.3k
0 votes
1 answer
59 views

.NetCore EF - Main query used by sync/async query

So I have a main sync query like: private List<MyCustomClass> Foo() { return _ctx.Table1.Where(...).Select(s => new MyCustomClass { ... }).ToList(); } and I need to use the results of it ...
CodeIT's user avatar
  • 75
2 votes
2 answers
199 views

How to run EF Core ExecuteUpdate using multiple Ids using different conditions for each Id

I have this ExecuteUpdate call below inside a for loop and I want to know if it's possible to eliminate the For loop and run ExecuteUpdate as one call? foreach (var registrant in yogabandEvent....
chuckd's user avatar
  • 14.4k
0 votes
3 answers
93 views

How to include() with two relations?

How do i use include() with two relations? CustomerSupplier has CustomerId and CustomerAddressId the relation matches the field in the table CustomerAddress. public partial class CustomerSupplier { ...
GrasM4n's user avatar
  • 25

15 30 50 per page
1
2 3 4 5
651