Add Identity endpoints in my API
Hey I would like to add the identity endpoints in my API I add this service in program "builder.Services.AddIdentityApiEndpoints<IdentityUser>() .AddEntityFrameworkStores<ApplicationDbContext>();" but…
Assign user to role during Registration
Hi Friends !!! I was wondering when a user Registers to my website can I assign them to a default role with the minimal privileges until I choose to add them to another role? Just wondering does the Startup.cs have some sort of Configuration that handles…
How to group monthly sales by currency in Blazor Server application?
Hello, I am working on a Blazor Server application and I want to get the monthly total sales. I need to group these sales by the currency (USD, EURO, TL) that they were sold. Here is the query I am currently using to group monthly sales, but I need to…
How to connect SQL server instance (Always on) with EF6.4 (.NET framework 4.8 Application in C#)
I am using Entity framework 6.4 (C# application) to connect SQL server database(always on) via availability group listener. I found that my application will throw exception when SQL server proceed failover from primary SQL instant to secondary instant.…
Scoped Life Time in .Net core
I added DBContext as scoped to project services When I use Promise.all to send requests from the frontend to send two requests at the same time, each request is processed separately and each one creates a new instance of the service. This creates two new…
How to fix error NU1608: Detected package version outside of dependency constraint: OpenFeature 1.3.1 requires System.Collections.Immutable (>= 1.7.1 && < 8.0.0) but version System.Collections.Immutable 8.0.0 was resolved.
I am getting below error - error NU1608: Detected package version outside of dependency constraint: OpenFeature 1.3.1 requires System.Collections.Immutable (>= 1.7.1 && < 8.0.0) but version System.Collections.Immutable 8.0.0 was…
How to separate out Identity server in a separate library to manage authentication of a user for multiple API projects in the application?
Suppose a solution has multiple different API projects so instead of re-writing the Authentication and authorization with an Individual user account (Identity Server) approach can we create a single library containing Identity server logic and use this…
How can I post multiple entries at once, when selecting multiple options from a Multi List Dropdown
Hi All, I have hit a bit of a snag with this. I have a form, which contains a multi select dropdown menu. I want to allow the user to select as many options from the drop down menu and upon pressing submit, each different item selected will be saved into…
How to get monthly order count by status in a Blazor Server application?
Hello, I am working on a Blazor Server application and need to find the number of monthly orders that are either completed or continue based on their status. I have a query that works for a specific year and status, but I need to refactor it to accept…
How to use the required modifier in C# properties correctly?
public class State { public int StateId { get; set; } public required string StateName { get; set; } public required ICollection<District> Districts { get; set; } public static void CreateNewState() { State state =…
Why do I get optional dependent using table sharing?
Hi all; I am getting the following warning: Microsoft.EntityFrameworkCore.Update: Warning: The entity of type 'Event.Description#RichText' is an optional dependent using table sharing. The entity does not have any property with a non-null value to…
How do I save a file to SQL Server using Razor forms?
I have built a web application that connects to a local SQL Server. I would like to use the web form to save a file in the database. I am experiencing an error related to the model types and provider types. When I use a byte array type for the…
Where and how should the database connection statement be stored?
Hello I am developing a wpf project with c# EF. I am currently using the Sqlite database file connection by defining it in the Configuring method. I think it is not the right approach to keep such information in the code. Where would it be healthier to…
how to include multiple entity in efcore?
public class MyEntity{ public int Id{get;set;} public MyEntityA EA{get;set;} public MyEntityB EB{get;set;} } _context.MyEntitys.Include(x=>x.Ea); how to Include EB . and in MyEntitiA there may be 3 or more entities.
How to map IQueryable object with a large data to another IQueryable object
Hello, I am currently working on a Blazor Server project and I am trying to map two IQueryable objects with Automapper. However, I am encountering an error and not sure how to solve it. Here is the error that I am getting: 2024-01-07…
How to use Scaffold-DbContext in .NET Core for Sqlite database
I'm using .NET Core Version 7 and I want to use EF Core to access a Sqlite (*.db3) database file. This file has a password and I want to add the database tables to the project through database first. The scaffold-dbcontext code is as follows, but it…
Microsoft.EntityFrameworkCore
Hello, I am using Microsoft.EntityFrameworkCore And SQLServer2022, but I have a problem. I added DBContext to my service as scoped, but I get this error. "The connection is already in a transaction and cannot participate in another…
"Need help with serving/streaming video files to frontend using Entity Framework, ASP.NET Core API (.NET 6) deployed on Azure App Services, and MongoDB deployed to Atlas"
Hi, I'm working on a project for streaming videos and I'm currently stuck on trying to figure out how do I serve / stream a video file for front end? If I run everything locally, the video stream is still sent from the backend to the frontend in chunk…
How to Auto Compute Date Time field in SQL server
I am trying to configure a field in model which is to be modified with insert and update. I tried multiple things but still could find the correct configuration for my requirement. Example : public class Author { public DateTime UpdatedAt { get; set;…