Skip to main content

All Questions

0 votes
1 answer
39 views

Seeding data when it has relationship

so i need to create foreach entity its own seed class. the problem becomes when the is some hierarchy of entities, like one entity has a relation with another, second has relation with third and so on....
Emil Abbas's user avatar
0 votes
0 answers
21 views

Change UsersRoles table PK

In Entity Framework Core 8, I'd like to change the default PK for UsersRoles table, currently set as follows: table.PrimaryKey("PK_UsersRoles", x => new { x.UserId, x.RoleId }); to ...
jinew's user avatar
  • 1
1 vote
0 answers
76 views

Issue with TPC hierarchy and relations in EF Core 8 + PostgreSQL

I have a problem when trying to use TPC hierarchy mapping in EF Core 8, where I get InvalidCastExceptions. What I wanted to do is have a BaseAuditedEntity class for most models in my app (only except ...
N.T. Dang's user avatar
0 votes
0 answers
28 views

Modeling legacy data in EF

I have a legacy .csv that my company uses to decode coded values in other tables. The .csv looks similar to this: Header Code Literal Description header1 X literal1X description1X header1 Y ...
hudsonsc's user avatar
1 vote
1 answer
62 views

Loosely-coupled database structure, interface for entities

Preliminaries: I am creating an application using .NET Core and EF Core. Here is the problem: consider two entities called Form1 and Car, like this: public class Form1 { public int Id { get; set; }...
beingmathematician's user avatar
0 votes
1 answer
94 views

Entity Framework Core problem: error within getting record: Unable to cast object of type

I have a problem that when I call multiple repository types in one class in one scope, I get an error: System.InvalidCastException HResult=0x80004002 Message=Unable to cast object of type '...
Tsko's user avatar
  • 63
0 votes
1 answer
55 views

C# and EntityFramworkCore: Error after running "$ dotnet ef database update".: Object reference not set to an instance of an object

I am building a website using the entity framework for databases and I got this error after simply renaming a field and removing another this is the last migration added: using Microsoft....
Mason England's user avatar
0 votes
0 answers
43 views

How can I write code that references its own class many to many while coding an ASP.NET Core database?

I have a "Word" class and I am trying to create a table that references "word" to keep the synonyms and antonyms of the words in this class in the database. My word class [Table(&...
Ali's user avatar
  • 1
0 votes
0 answers
52 views

EF Core Database Model creation with IDatabaseModelFactory.Create() slow

I'm using EfCore.SchemaCompare with a MariaDB Database (10.4.12) over Pomelo inside .NET 8. The Compare is working but very slow. Inside EfCore.SchemaCompare the Method databaseFactory.Create() (...
JIT Solution's user avatar
2 votes
0 answers
76 views

How often do you need to re-create the connection to SQL Server?

I did an experiment with the speed of writing to the database. I have several tables where logs are stored. I took 1 million logs and sent them in batches of 750 records into the database, while ...
svstnv's user avatar
  • 233
1 vote
1 answer
83 views

Updating an object in the database fails with: 'Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException'

I am trying to update an existing BusinessPartner from the database, but it fails with "Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException" I added: [Timestamp] public byte[] ...
fass33443423's user avatar
0 votes
1 answer
33 views

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Projets_Plannings_ID_Projet"

I get this exception error while debugging Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. Inner Exception : ...
SpikeSp's user avatar
0 votes
2 answers
53 views

Failure when updating database

After running update-database, I got this error PM> update-database Build started... Build succeeded. Applying migration '20240403225657_InitialMigration'. Failed executing DbCommand (44ms) [...
SpikeSp's user avatar
2 votes
1 answer
65 views

Database error ; the value of the foreign key is unknown

These are the models public class theTask { [Key] public int TaskId { get; set; } [MaxLength(50)] [DisplayName("Tasks")] public string Tasks { get; set; } public ...
user23541634's user avatar
0 votes
1 answer
25 views

Issue with Setting Relationships in Business Entity when Creating New Business with Associated Services and Workers

When attempting to create a new Business entity by passing a JSON payload that includes associated Services and Workers, I noticed that the Services and Workers collections within the Business entity ...
Vaclemor's user avatar

15 30 50 per page
1
2 3 4 5
19