All Questions
Tagged with .net-6.0 entity-framework
132
questions
0
votes
0
answers
42
views
Populate a many to one relationship and how to show data input only once but increment if the date in the input are the same
I am currently working on a web project that required user to input a group of value for each person in a department per day then display it in two other index for day and month. I'm having problems ...
0
votes
0
answers
15
views
Catching a raiserror from trigger with EF
I'm using .NET 6 with EF. I have a table with an insert trigger, in which I have a
raiserror (@errmsg, -1, -1)
From the .NET project, I need to catch this @errmsg after calling SaveChanges(), but I ...
2
votes
0
answers
63
views
EF6 Find function always go to the DB
I was wondering why Entity Framework in my code was so "chatty" with the DB.
after searching in Microsoft documentation, I found that normally, when using "T DbSet.Find(params object ...
0
votes
1
answer
32
views
Cant use controller scafolding o my .net project, Error:"there was an error running the selected code generator package restore failed"
Im trying to create my controllers using scaffolding, but Im getting the error "there was an error running the selected code generator package restore failed".
All my EF packages are at the ...
1
vote
1
answer
213
views
Upgrading from Entity Framework 6 to EF Core moving to AspNetCore.Identity dealing with schema migration issues with existing databases
We are in the process of upgrading a large multi-tenant application (single web app with multiple databases that have identical schema) from .Net Framework 4.8 to .Net 6, this includes moving from ...
0
votes
0
answers
39
views
Invalid column name error while removing shadow property. creating Shadow FK Index in entity 6 on while OnModelCreating and Its causing run time erro
We are migration Entity from 3.1 to 6.0 . A shadow property was defined in 3.1 which we cannot create in 6.0. so We removed that property but while calling DB with this entity it was creating a shadow ...
2
votes
2
answers
137
views
DbContext - passing custom configuration option
I have .NET Core 6 web application with Entity Framework.
My DbContext is something like:
public class MyDbContext : DbContext
{
public MyDbContextDbContext(DbContextOptions<MyDbContext> ...
0
votes
1
answer
78
views
Get last message (either sent/received) in .Net 6 with Entity Framework
Requirement: Get last message (either sent/received) in .Net 6 with Entity Framework.
Issue: .DistinctBy() is not working with multiple parameters.
IQueryable<Chat> query = _context.chats
....
1
vote
2
answers
304
views
Injecting userid in DbContext for multi-tenant application
I am building a multi-tenant application with .net identity. I want each user when they log in to view their own data. I have a user resolver service where i inject httpContextAccessor to try to ...
0
votes
1
answer
170
views
.net 6.0 EF and a long running process
I have an ASP.NET Core 6.0 Web API that uses EF to interact with SQL Server.
I have a stored procedure that is responsible for rebuilding projection tables that takes about 10 minute to run.
I have a ...
0
votes
0
answers
54
views
How to make a DbSet property for a Model in DAL
I'm encountering an issue when attempting to add a new Razor View with a Create template and a model that uses DatabaseContext as its class. The error I'm facing is as follows:
There was an error ...
0
votes
1
answer
699
views
Configuring DbContext in .NET 6 for PostgreSQL
First, I show my db-related classes:
DbContext.cs
public class BookingDbContext : DbContext
{
public BookingDbContext(DbContextOptions<BookingDbContext> options) : base(options)
...
0
votes
2
answers
334
views
IQueryable model does not contain definition for GetAwaiter and no accessible extension GetAwaiter accept first argument of type IIncludableQueryable
I am getting the error above when I try to do a query to the database. This was working fine in .NET 5, but as soon as I created a new project in .NET 6 and using exactly the same query, I'm getting ...
1
vote
0
answers
95
views
Ef core6 message error "Nullable object must have a value"
My DB data
Fee table:
HospitalId
DoctorId
Price
Status
NULL
a5bf5fa0
100
1
08bbB233
a5bf2G2f
50
1
TimeSlot table:
ID
Duration
Status
B233tb35
30
1
08bbB233
20
1
Model and relationship
Hospital ...
0
votes
0
answers
72
views
No database provider has been configured for this DbContext .NET 6 without OnConfiguring
When I use the command to add the migration, I get two errors:
Unable to create an object of type 'ApplicationDbContext'. For the different patterns supported at design time, see https://go.microsoft....