All Questions
Tagged with entity-framework-core entity-framework-migrations
562
questions
0
votes
1
answer
76
views
Receiving TaskCanceledException when using passwordless authentication with Azure Functions and Entity Framework with SQL Server
I am using Isolated Azure Functions and SQL Server with Entity Framework. This is configuration I am having inside my Program.cs of corresponding Azure Function App:
var connectionString = ...
0
votes
1
answer
73
views
EF Core migration for schema based table creation in multi-tenant ASP.NET Core application
I am trying to create tenant-specific schema table for multi-tenant application. Something like below
CREATE SCHEMA Tenant1;
CREATE TABLE Tenant1.Customers
(
CustomerId INT PRIMARY KEY,
Name ...
0
votes
1
answer
61
views
EF Core 8: migrations adds AlterColumn to every column, for subsequent migrations
I have an old application in .NET Core 3.1 and EF Core 3.1. I have successfully migrated to .NET 8 and EF Core 8. The migrations folder was HUGE, so I reset the migrations, deleting all records in the ...
1
vote
0
answers
48
views
Foreign keys in Entity Framework Core in an ASP.NET Core Web API
I have a small question and request regarding the code-first approach with Entity Framework Core.
Let's suppose I have a class A and a class B.
public class A
{
[Key]
public Guid Id { get; set;...
0
votes
0
answers
41
views
Adding a match type to a foreign key with EF Core and Npgsql
When creating a foreign key that references multiple nullable columns in Postgresql it's possible to add a match type of "MATCH FULL" on the foreign key to ensure that all values are either ...
0
votes
0
answers
37
views
Prevent Entity Framework Core migrations to generate scripts using syntax like $EF$
I'm using Entity Framework Core v6.0.12 and its migrations to generate SQL scripts using:
dotnet ef migrations script --idempotent PreviousMigration CurrentMigration --output Scripts/CurrentMigration....
0
votes
0
answers
115
views
Unable to create a 'DbContext' of type ''. EF Core 8.0 migration
I got this error when Entity Framework Core tools attempt to instantiate my DbContext at design time. Despite having a proper constructor and registering the context correctly in Program.cs, the tools ...
0
votes
1
answer
47
views
.NET Core / Blazor model attribute that doesn't get persisted to database
I have a model in my Blazor app that I want to create a "transitory" attribute for. This attribute is used internally in the app, but I do not want to persist it to the database.
However, ...
0
votes
0
answers
52
views
EF Core: Cannot delete or update a parent row: a foreign key constraint fails
I have a DataContext class that contains some seeding methods and which is defined as follows:
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using ...
-1
votes
1
answer
72
views
The exception 'The entity type 'PostEntity' requires a primary key to be defined
I am new to .NET so excuse my lack of knowledge.
I'm trying to create a simple Web API using Fast Endpoints and Ulid as id to the entities and Entity Framework Core.
Here is my code:
PostEntity.cs:
...
0
votes
0
answers
21
views
complex migrations with moving data
I have asp .net core application. I would like to split table with data into the more parts and migrate some data from one table into the new one. Is there a way how to do that?
Before:
table_a
-------...
1
vote
1
answer
217
views
Unable to create a 'DbContext' of type ''. The exception 'Object reference not set to an instance of an object.'
I am trying to create migration using Add-Migration InitialMigrations in my Asp.net Core 8 Web API project, but I am getting the following error:
Unable to create a 'DbContext' of type 'AMSContext'. ...
0
votes
1
answer
54
views
"No database provider has been configured for this DbContext" Entity Framework Core
I'm using standalone Entity Framework Core with Discord.NET. I have created a DbContext and added it as a service inside my program entry point.
For some reason I am getting this error whenever I try ...
1
vote
0
answers
26
views
Tables not being renamed using EF Core Fluent API
newbie to .NET and development in general,
I am trying to rename some tables in EF Core, but the changes aren't being reflected when I view the Db diagram using EF Core Power Tools.
In the code ...
1
vote
0
answers
49
views
The seed entity for entity type 'IdentityUser' cannot be added because no value was provided for the required property 'Id' when seeding default users
I'm trying to seed 2 default users (admin & standard user) using data migrations and I'm getting an error with the Id property of the IdentityUser entity. This is the code I'm using:
internal ...