8,518 questions
0
votes
0
answers
86
views
Is it possible to define a navigation property without a foreign key in EF Core when using microservices?
Disclaimer: I’m still new to designing micro service architectures.
After a user obtains an access token from an external identity provider, I want them to be allowed to access the /questions endpoint ...
0
votes
1
answer
84
views
Trying to populate very similar relations through same property
I am trying to define two classes with the same collection-relation, through the same key on a third class, preferably using EF 6 code annotations.
I have three tables;
Current is a quick reference. ...
0
votes
2
answers
63
views
How to create two table from one class by EF Core
I have a class for users :
public class users
{
public int UserId { get; set; }
public string UserName { get; set; }
// ....
}
I want to create a table called users. I write this line in ...
0
votes
0
answers
64
views
SqlException: Invalid column name (EF DBFirst to CodeFirst)
I know there are a ton of QAs on this topic but none of the answers I've looked at have helped me. I'm sure it's something simple.
I am in the process of moving from database-first to code-first using ...
0
votes
0
answers
27
views
Separate navigation properties for distinct subtypes in TPH hierarchy
I have an Entity Framework 6 (v6.5.1) code-first model like this (type names have been changed to anonymise the code):
public abstract class Point
{
public long ID { get; set; }
public long ...
0
votes
1
answer
72
views
How do I display the Sum records of a child property in a field in the parent model?
How do I display the Sum records of a child property in a field in the parent model?
for example
Order Model:
public class Order
{
[Key]
public int Id { get; set; }
public string Title ...
1
vote
1
answer
188
views
DbUpdateConcurrencyException in EF Core during SaveChangesAsync
I'm working with Entity Framework Core and encountering the following error:
Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException
Attempted to update or delete an entity that does not exist in ...
0
votes
1
answer
54
views
Can I insert ID 0 in MySQL with EF Core HasData?
I'm writing a server for a client that I do not control. I'm using HasData to seed the database with static information that the client refers to by ID. The client uses 1-based numbering for almost ...
0
votes
1
answer
45
views
How can I ignore an FK defined in a base type when using TPT in EF Core
I have an Entity Framework Core model defined as follows:
class User
{
public int ID;
public ICollection<Foo> OwnedFoos;
}
[PrimaryKey(nameof(ID), nameof(OwnerID))]
class Foo
{
...
0
votes
0
answers
55
views
EF Core does not allow Cascade Delete on 2 foreign keys, but Blazor sample web app does this just fine
I have seen countless posts advising that EF Core with SQL Server blocks multiple foreign keys which have "OnDelete Cascade" (due to cycles and multiple delete paths). However I see in the ...
1
vote
1
answer
163
views
Entity Framework Core 8 : many-to-many relationships issue when updating the data
I'm building an Entity Framework Core web project using code first migrations and when I update the data via update method, I get the following error message:
Violation of PRIMARY KEY constraint '...
0
votes
0
answers
29
views
EFBundle - detect that no migrations were applied
In the event that my generated EFBundle.exe does not find any migrations to be necessary for the database instance, the only indication seems to be this line in the output
No migrations were applied. ...
0
votes
0
answers
21
views
Getting error while using Add-Migration Initial
I have been trying to use code first approach to create a database via already written models and context class. Below is my context class for reference.
using BankLibrary.Models;
using Microsoft....
0
votes
1
answer
195
views
How to create migrations with multiple projects architecture in ASP.NET Core 8
I have created two projects in ASP.NET Core 8:
1. Web API project which contains
Connection string in appsettings.json
DbContext registration along with connection string in Program.cs file
2. Class ...
0
votes
1
answer
1k
views
Storing an owned entity as JSON, and managing updates to the object graph
I'm using EF Core (8.x) and Posgresql for storing some data. Specifically, I have an entity type which has a (navigation) property holding an entire object graph, that I have specified in ...