Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
0 answers
25 views

My understanding of C#'s null safety features (from C# 8.0 onwards) is that (possibly) null variables must be typed as nullable and that the compiler will statically detect any parts of the code which ...
ducksforever's user avatar
1 vote
1 answer
81 views

I have two tables Products and CustomerProduct. I need to compose an Entity Framework Core object that returns the result based on arguments of the Web API endpoint method. The method roughly works ...
pepr's user avatar
  • 21.1k
0 votes
1 answer
94 views

Is it possible to have a type in Entity Framework Core that doesn't create FKs to every other table that uses it? Creating the DB-Scheme from the C#-model with Add-Migration and Update-Database. For ...
Ramzi Khahil's user avatar
  • 5,106
0 votes
2 answers
78 views

I am trying to link a many-to-many relationship without any intermediary class in my domain. The link is SoundProfiles <-> Switches. They're both not required. The error I get is One or more ...
Yves Schelpe's user avatar
  • 3,513
1 vote
1 answer
92 views

I'm getting this error : Unable to create a 'DbContext' of type 'AppDbContext'. The exception 'Object reference not set to an instance of an object.' was thrown while attempting to create an instance....
Eray Bal's user avatar
12 votes
5 answers
3k views

I’m trying to install the Entity Framework Core CLI tools globally using the .NET CLI command: dotnet tool install --global dotnet-ef However, the installation fails with the following error message: ...
tutte2k's user avatar
  • 301
Advice
2 votes
3 replies
110 views

Do you know if EF Core correctly processes queries that apply filters and paging and select data from tables with one-to-many relationships when .AsSplitQuery() is used? If you go here: https://learn....
boggy's user avatar
  • 4,057
1 vote
1 answer
157 views

I am attempting to create a new EF Core migration using the add-migration command in the Visual Studio Package Manager, but the command is failing with the following error: The running command ...
user1474992's user avatar
3 votes
1 answer
110 views

I'm creating a self-contained publish of my ASP.NET Core application. When I run it on my development machine, everything works correctly: the app can connect to the remote SQL Server and db.Database....
AbdAlmalek Mokresh's user avatar
3 votes
3 answers
119 views

How do you delete rows in tables using Entity Framework (Core), when you have two tables that are referencing each other in both directions? Consider there classes: public class ImageSeries { int ...
haagel's user avatar
  • 2,758
2 votes
0 answers
99 views

I'm connecting to an Oracle database using EF Core. When scaffolding the database (Scaffold-DbContext), EF Core automatically maps columns of type NUMBER(1,0) to bool. To avoid this, I changed the ...
Yafa's user avatar
  • 21
1 vote
2 answers
122 views

I have the following classes in my (code-first) Entity Framework Core database schema: public class User { public int Id { get; set; } // ... Irrelevant bits omitted } public class Church { ...
In Hoc Signo's user avatar
1 vote
1 answer
171 views

I have the following interface signature that I want to use for a more efficient bulk update using EF Core 8.0.6 using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using ...
Josh's user avatar
  • 2,088
3 votes
2 answers
121 views

I have a project that has uses a database-first approach. I have used db-scaffold to create the models and have also created 'custom' models to contain extra info and code. I have a model class ...
Paul's user avatar
  • 33
1 vote
1 answer
113 views

I just added an EF entity called PurchaseOrderProduct, which creates a many-to-many link between my PurchaseOrders and Products. [PrimaryKey(nameof(PurchaseOrderId), nameof(ProductId))] public class ...
Jonathan Wood's user avatar
6 votes
3 answers
210 views

I have a SQL Server database I mostly interact with using EF Core in a .NET project: I'll analogize my domain logic for simplicity. I have a Fruits table holding general fruit data in columns Weight, ...
Mr. Kloud7's user avatar
0 votes
2 answers
82 views

I need to rewrite the code for getting and filtering the list of products. The older version used directly the SQL table Products, and filtered the result by code or name of a product, category, etc, ...
pepr's user avatar
  • 21.1k
2 votes
1 answer
54 views

I am facing this problem at migration - here are my model classes: // Principal (parent) public class Blog { public int Id { get; set; } } // Dependent (child) public class BlogHeader { ...
user2843511's user avatar
1 vote
0 answers
227 views

I get this error when migrating from Entity Framework: dotnet ef migrations add initApp Unable to create a 'DbContext' of type 'RuntimeType'. The exception 'Unable to resolve service for type '...
Andres Miguel Campos's user avatar
1 vote
1 answer
97 views

I've got a class model with two principal classes (PrincipalEntity1, PrincipalEntity2) which are both related to the same child entity (TwiceDependentEntity). PrincipalEntity2 is related directly to ...
kjeld-jensen's user avatar
0 votes
0 answers
123 views

When setting the value on the entity, it works as easily as assigning an empty collection to the property. The property has converters to-from JSON. However, both throw exceptions: await db....
ZorgoZ's user avatar
  • 3,758
0 votes
0 answers
41 views

When I ran a scaffold command on my NPGSQL db with the typical default format I find on the web: Scaffold-DbContext <connection-string> OutputDir Models -Force It created all my model classes ...
Trant's user avatar
  • 3,651
3 votes
1 answer
259 views

I'd like to rename a table in Entity Framework Core, code first. I do not want to drop and create the table, as this would lose all my data. As I search for information on this, I see that the vast ...
Jonathan Wood's user avatar
1 vote
0 answers
55 views

I have an ASP.NET Core 8 app with a long-lived service that refreshes an in-memory cache on a timer. I registered the service as a singleton (it’s a hosted background worker), and it needs to query ...
Michael Ding's user avatar
0 votes
1 answer
101 views

I'm in a .NET 6 web application with EFCore, and I have these boilerplate abstract classes and interfaces for defining entities. I know it's quite a number of complexity layers, but it really helps me ...
Davide Vitali's user avatar

1
2 3 4 5
471