entity-framework-core Questions

2

Solved

EF Core 5 has various events, but they relate to DbContext. There are no events related to migrations (Migration). I want to run custom code after all migrations are applied - whether triggered by ...

10

Solved

I have a DbContext named FileManagerContext in my DOTNET 6 API: public class FileManagerContext : DbContext { public FileManagerContext(DbContextOptions<FileManagerContext> options) : base(o...
Braunstein asked 2/2, 2022 at 15:30

2

I have an EF model with a notification emails property. The notification emails are saved in the database as string separated by ';'. I added a conversion to retrieve the data as a ICollection in t...
Mindi asked 13/5, 2019 at 8:58

2

I had the following attribute property for my EF 6 .Net Framework app: [AttributeUsage(AttributeTargets.Property)] public sealed class DecimalPrecisionAttribute : Attribute { public DecimalPrec...
Sheffield asked 14/10, 2017 at 20:30

4

As part of my EF 6.1 to EF Core 2.0 migration I added a simple test to check if the concurrency tokens do work the same way. I noted, however, that is dependent on the underlying database provider:...
Gabbi asked 29/10, 2017 at 6:30

3

Solved

I have a database table created 20 years ago in my company, it is only used for journaling, with NO PRIMARY KEY or INDEX. I can't alter that table. I understood that we need to call HasNoKey() in ...
Aflcio asked 6/2, 2020 at 13:53

4

I am new in Entity framework core, I am making a simple short project. In my project I use trigger. But when deleting multiple items, the trigger shows an error : "Invalid attempt to call Read...
Bellboy asked 8/10, 2017 at 4:57

1

While looking for a solution to store all our enums as strings in the database, i came up with the following code. protected override void ConfigureConventions(ModelConfigurationBuilder builder) { ...
Solange asked 11/11, 2021 at 9:44

3

Solved

What is the code-first approach to set the default value of a database column in entity framework core? Attempt #1: Using the DefaultValue attribute on the model doesn't seem to work [DefaultValue(...

4

Solved

I have a list of checkbox elements in a html page, all selectable and with distinct IDs, and its IDs are send by HTTP POST to my API. For security, I need to check if any of the sent IDs is invalid...
Unborn asked 7/5, 2018 at 22:6

2

With Entity Framework Core, I need to check the original values of a navigation property inside my entity but i can't find a way to do it. I'm able to read the original and the current values of t...
Calendula asked 18/4, 2019 at 17:19

2

Solved

I have implemented an approach for tracing SQL queries from EF Core according to this article: https://learn.microsoft.com/en-us/ef/core/miscellaneous/logging. And have problems with tracing query ...
Ferrochromium asked 26/5, 2017 at 13:9

4

Solved

In the new MVC Core it seems the standard way to get the context to the controller is by doing this public class BaseController : Controller { public readonly ReportDBContext _db; public BaseCo...
Mayle asked 16/6, 2020 at 14:53

9

Solved

I'm trying to install the dotnet-ef tool via the dotnet-cli. The command that I enter: dotnet tool install --global dotnet-ef I gives me the following error: The tool package could not be restor...
Arctogaea asked 8/11, 2019 at 10:1

3

When I'm trying to add a migration using EF Core (7.0.0-rc.1.22426.7) I'm greeted with the following error in the console: System.TypeLoadException: Method 'Fragment' in type 'Microsoft.EntityFrame...

3

Solved

The problem I have a client application which loads a local data file. This data file specifies for each item the Type and Version. From this file, I compile a list of Type and Version pairs. var t...
Lox asked 17/1, 2022 at 16:4

8

Solved

the asp.net core MVC report error after certain times of query to the mysql database (on Ubuntu 14.04/16.04) with the following message: "The configured user limit (128) on the number of inotify in...
Fluecure asked 18/4, 2017 at 10:15

2

EF Core (like EF before it) automatically adds properties with a get/set to the model. I use the Fluent API, and I need to remember to ignore them, and it gets tedious - I always get runtime error...
Amendment asked 20/4, 2017 at 6:30

3

Failed to create an editor. the parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) Error Script-Migration -From "PreviousMigration" the Update Visual Studio Commu...

4

Solved

Running dotnet ef migrations add XYZ will result in a Migrations directory being created in the project. Should this directory be committed to version control (Git, etc)?
Factory asked 23/8, 2020 at 5:30

4

Solved

I have a LINQ expression that is working fine on the production database but throws an error on the SQLite in-memory database of the test context: The LINQ expression (EntityShaperExpression: Enti...
Inland asked 3/3, 2020 at 9:1

5

this is my first question and sorry about my weak language. I've got a table like this model; public class Menu { [Key] public int ID {get;set;} public int ParentID {get;set;} public string...

4

I know this question has already been asked but I couldn't find an answer that satisfied me. What I am trying to do is to retrieve a particular DbSet<T> based on its type's name. I have the ...
Rathe asked 26/11, 2015 at 13:56

10

Solved

I followed the Getting Started on ASP.NET 5 guide about Entity Framework 7 and I replaced Microsoft SQL Server with SQLite, the only difference in the code is in Startup.cs: services.AddEntityFrame...

3

Solved

I want to generate and apply the migrations, I ran the following on the command line from within project's folder. AuthServer.Infrastructure> dotnet ef database update --context AppIdentityDbCon...

© 2022 - 2024 — McMap. All rights reserved.