Questions tagged [.net-7.0]

Use this tag for questions specifically related to version 7.0 of the .NET platform. For questions on .NET Framework generally, use the .net tag.

1169 questions
2
votes
1 answer

How to add .NET 7++ to Visual Studio 2022++ as target framework?

I just installed the .NET to my machine. Yet, Visual Studio 2022 doesn't list the new SDK in its list of target frameworks: In Visual Studio Installer there is no ".NET 7 Target Framework" option to check. How can I get Visual Studio 2022 to list…
AxD
  • 2,714
  • 3
  • 31
  • 53
2
votes
2 answers

Problem with using ExecuteDelete and ExecuteUpdate in .NET 7

I've faced the problem with using ExecuteDelete in the abstract generic class. Can someone explain in what cases ExecuteDelete and ExecuteUpdate cannot be used? Tagret framework is set to .NET 7 Here is how my code looks: using…
2
votes
0 answers

How to get the names of the DbSet properties included in an Entity Framework query?

I have the following DbSet properties defined in my DbContext class: public virtual DbSet Employees { get; set; } public virtual DbSet Companies { get; set; } public virtual DbSet Products { get; set; } Each employee…
IvanH
  • 5,039
  • 14
  • 60
  • 81
2
votes
1 answer

EntityFrameworkCore 7 SetProperty(avar,avalue) Unable to cast object of type 'TypedParameterExpression' to type 'LambdaExpression'

Visual Studio 2022 .NET 7.0 ASP.NET Core Web API Project OS Windows10 Microsoft.EntityFrameworkCore 7.0.9 My code: 1.Error ADal aDal = new ADal(); Func p = property => property.Balance; aDal._databaseContext .ModelDbSet .Where(w…
Allen
  • 21
  • 1
2
votes
1 answer

How to increase Rate Limit at runtime?

I've read the docs but couldn't see if it is possible. For example, how to implement a token bucket limiter that is increased limit if user pays for it? There is autoReplenish property but what happens if you set it to false? Can we increase the…
Baran
  • 362
  • 2
  • 10
2
votes
3 answers

Http POST does not work in asp.net core, only when server stops

I'm new on asp.net core with .NET7.0, and I'm trying to develop a simple web app that comunicates with a PC on the same LAN and responds to an http POST sent by the web server. To send the httpPOST I use the HttpClient library. First of all, my…
2
votes
2 answers

Is all the code in an ASP.NET Core project consist of middlewares?

I am taking some lecture on Udemy and from the lectures what I interpret is that all the code in a .net core project are some kind of middlewares? I mean is there a specific boundary where the middleware ends and the actual code of the app starts?…
2
votes
1 answer

Converting null literal or possible null value to non-nullable type DESPITE null-coalescing operator

I'm still quite new to C# (about 4months in) and I don't understand why this would be an issue. Run on DotNet Fiddle #nullable enable using System; using System.Text.Json; using System.Text.Json.Nodes; public class Test{ public static void…
infinitezero
  • 1,610
  • 3
  • 14
  • 29
2
votes
1 answer

Configuring Kestrel on .NET 7.0, but not quite sure how to do it correctly and need some guidance

I am a beginner in .NET Core and I am trying to configure a custom domain to be able to use HTTPS for my ASP.NET Core 7.0 Web API. I was following this guide: Custom Local Domain using HTTPS, Kestrel & ASP.NET Core, but as you can see, he uses .NET…
Oddy
  • 21
  • 1
2
votes
1 answer

IExceptionFilter in minimal .NET 7 API

In my ASP.NET Core app I was registering an IExceptionFilter to globally catch exceptions and replace the Result returned to the client. I'm now switching to the minimal API way of doing things, but I'm not finding where I register that filter. In…
Gargoyle
  • 9,590
  • 16
  • 80
  • 145
2
votes
1 answer

PropertyChangedEventHandler under .NET 7

I defined the PropertyChangedEventHandler in this way: public event PropertyChangedEventHandler PropertyChanged; Since I switched to .NET 7 I get 2 error messages. Once CS8612 (Nullability of reference types in type doesn't match implicitly…
Sascha
  • 37
  • 6
2
votes
1 answer

Is there a way to add scoped service which is repository to ASP.NET Core 7 MVC?

I have a category db. I need to build controller part for CRUD operations. I created repository interface, class and also configure the controller part but I can't add the service to Program.cs file. How can I fix that ? IRepository.cs: using…
2
votes
0 answers

Can't get callback notifications from IOKit to fire using pInvoke

I'm trying to write a .net multiplatform library, and macos is giving me some trouble. I'm attempting to use IOKit to let me know when a serial port has been plugged or unplugged, and from there, I can use the standard .net serial port libraries to…
sonic1015
  • 31
  • 4
2
votes
0 answers

Clear DBContext pool (EF & SQL Server)

I'm using .NET 7 and EF Core 7 to access SQL Server. I have basically an API application which can receive requests and uses EF for DB stuff. It potentially will serve thousands of requests per minute depending on the specific deployment, and uses…
GPW
  • 2,528
  • 1
  • 10
  • 22
2
votes
1 answer

Highlight specific characters in all Cells of a DataGridView

When I do a character search in the DataGridView, I want only the searched specific characters to be selected (I give it a red box), without selecting all characters in cell. How do I do it? I wrote code, and the result looks like this: Output…
Ihdina
  • 950
  • 6
  • 21