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

How to add to a list from view and pass it to controller in ASP.NET Core and Entity Framework

I want to save information of TV programs faults. Each TV program has a number of different platforms. First user select the TV program then on the view I have a for each loop that shows the platforms ...
nadjmeh's user avatar
0 votes
1 answer
30 views

Why string property must be declared as nullable string in Entity Framework Core when corresponding database table column is nullable

Entity Framework Core version is 8.0. Here is my model. public class Item { [Key] public long ItemId { get; set; } public string KeyNumYear { get; set; } ... } In ...
Robin Sun's user avatar
  • 1,536
-2 votes
0 answers
37 views

SQL Server timeout from EF with SQL Server 2022 [closed]

Same code in both environments; running on .NET 4.8 and using Entity Framework. One environment runs SQL Server 2016 - everything works without problems. The other environment runs SQL Server 2022 - ...
supremo's user avatar
  • 143
0 votes
0 answers
38 views

Is there a way to create foreign keys at runtime in Entity Framework?

For background, let's say I have two classes: public class OrderType1 : ModelBase { public string Customer { get; set; } } public class OrderType2 : ModelBase { public string Customer { get;...
Thomas's user avatar
  • 43
-1 votes
0 answers
51 views

Can we use input parameter in SQL Server view? I want to filter data based on condition [duplicate]

Can we use input parameter in SQL Server view? I want to filter data based on condition. For example User id select Date range else others filter with others condition. I am trying to use a SQL Server ...
Jeevendra Singh 's user avatar
2 votes
1 answer
21 views

EF6.5 SetExecutionStrategy vs SetTransactionHandler

I'm somewhow lost in the documentation for SetExecutionStrategy and SetTransactionHandler for SQL Azure. I'm using Entity Framework 6.5.1 in a .Net Framework 4.8 winforms app together with Microsoft....
becky's user avatar
  • 337
0 votes
0 answers
10 views

Cannot Remove Migration in EF Core 8 Seed Data: The seed entity ... cannot be added because a default value was provided for the required property

Using the EF Core 8 command line utility to remove a seed data migration, I get this error: Unable to create a 'DbContext' of type 'MyDbContext'. The exception 'The seed entity for entity type 'User' ...
Ella's user avatar
  • 475
0 votes
0 answers
58 views

Entity Framework not saving data into database

I made a simple app where you can give the program xml files and it pairs the products inside them by manufacturer part number, but it is not saving it into the db, however if the product is already ...
Indoraptor's user avatar
0 votes
0 answers
10 views

Issue with $compute and $select on Array Properties in OData Query

I'm working with OData and I've encountered an issue when using the $compute and $select query options with properties of type array. Here's what I'm trying to achieve: Query URL for Non-Array ...
charbel abou khalil's user avatar
0 votes
0 answers
35 views

How to Make Grouped Query with Specific Key Fields Translatable by EF Core?

I'm working on an application where I need to insert data into a database while avoiding duplicates. To achieve this, I group the imported data by several fields, extract the key fields, and then ...
Dilshan Prasad's user avatar
0 votes
0 answers
20 views

Problem with Bounded Context and Shared DbContext Base in a Modular Monolith using DDD

I am relatively new to Entity Framework, and I might be misunderstanding some concepts, so I need some guidance. I am building a modular monolith using Domain-Driven Design (DDD) and trying to apply ...
Gabriel Ribeiro's user avatar
0 votes
1 answer
63 views

Serialization error when trying to register an entity in the database [closed]

I am experiencing a serialization error when trying to register an entity. When searching for another entity, related to the one that is going to be registered, a serialization error occurs. using ...
Vinicius Dyonisio's user avatar
0 votes
0 answers
70 views

Enum.GetName Returning Null When Converting Enum to String in C# Stored Procedure Call

I'm working on a C# application where I need to pass a value from an enum to a SQL Server stored procedure, but the database expects a string input, not an integer. I'm using Enum.GetName to convert ...
Gen's user avatar
  • 45
0 votes
1 answer
54 views

Entity Framework Core Error: "Instance of entity type cannot be tracked because another instance with the same key value"

I'm working on an asynchronous method in C# that inserts a list of records into a SQL Server database using Entity Framework Core. The method is intended to bulk insert data into the database and save ...
Dilshan Prasad's user avatar
0 votes
1 answer
42 views

Adding DataTable as user-defined table type to SQL Parameter in C# / .NET [closed]

I am trying to pass in a UDTT as a parameter to my stored procedure in C#. I have executed my stored procedure in SSMS and it runs correctly, my issue is specifically getting the parameter passed in. ...
jayson's user avatar
  • 1
0 votes
0 answers
56 views

Entity Framework Concurrency token is added to insert query

My app is using postgres with EntityFramework6.Npgsql (DB first). I'm trying to resolve concurrency issue using xmin column hidden system column of postgres. I added it to c# model class like this: ...
eXPerience's user avatar
0 votes
1 answer
61 views

Update many-to-many table with composite primary key in Oracle

I have 2 tables and a many-to-many relationship between them. For this many-to-many relationship to work, I created a new table. This many-to-many table has only the ids of the other 2 tables: ...
Claudiu Dascalu's user avatar
1 vote
1 answer
80 views

ASP.NET MVC application : form redirects to non-existing page instead of saving data to database

I am working on an ASP.NET MVC application where I have created a product page with all the necessary MVC components (model, view, controller). However, when a user fills out the form on the product ...
Faisal's user avatar
  • 21
1 vote
0 answers
48 views

SaveChangesAsync throws but actually the changes were saved

I am using EF Core version 8.0.8 with SQL Server database. Due to recent problems in our IT infrastructure, the database is running slower than usual and we often run into query timeouts. We observed ...
pschill's user avatar
  • 5,459
0 votes
1 answer
27 views

ORA-00933: SQL command not properly ended in C# with Entity Framework (INSERT ALL with commit)

I try to read a SQL file during the Entity Framework update-database command: public override void Up() { this.SqlResource("Migrations.SqlMigrations.ImportData.sql"); } Update-Database -...
optPr1me's user avatar
0 votes
0 answers
39 views

ASP.NET Core Service Worker and Web API

Can you help me to figure it out? I have an ASP.NET Core Web API with identity server and Entity Framework, in a single solution with worker service. I saw that in ASP.NET MVC people connect them as ...
SovaTroon's user avatar
0 votes
2 answers
38 views

Microsoft InMemoryDatabase doesn't connect relationship in Entity Framework during test

Result in test should be 3, but it's zero. This is because in Get method .Include() line doesn't connect Task to Entries. But in debug mode in Autos they seems to be connected. This works in live code,...
Lucas Adams's user avatar
0 votes
1 answer
40 views

Entity Framework 6 change tracker issuing statements in the wrong order

Problem description I have a method that syncs changes to graphs of entities to the database by comparing the received entities with the corresponding database rows and then updates the ChangeTracker ...
Oskar Sjöberg's user avatar
-3 votes
3 answers
142 views

How to save nested JSON into SQL Server using C# on .NET Core with Entity Framework?

I have my JSON objects in this format: [ { "id": "k002f3d", "usage": { "sent": 0, "recv": 2, ...
Veasna's user avatar
  • 143
0 votes
1 answer
50 views

Entity Framework Core foreign key naming issue with inheritance

I'm experiencing an unexpected behavior with Entity Framework Core when creating migrations for my Person class hierarchy. Specifically, when I generate a migration for the Person class, I get a ...
Programmer In The Making's user avatar
0 votes
0 answers
23 views

How to define the EF on complex object?

I try to create code and use Entity Framework for saving this data into a database. I have tried many ways to insert it into the table, using the function OnModelCreating, but each time I get error. ...
Nib's user avatar
  • 41
0 votes
1 answer
82 views

Many-to-many with details and temporal

I have two tables that are a many-to-many relationship. I use temporal tables to track the changes to the records, so that I can see updates and deletes for audits or to compare changes. In this ...
jason's user avatar
  • 3,575
0 votes
0 answers
52 views

Disable AutoTransactionBehavior in EF Core to MongoDB

I'm developing an API locally that makes calls to a locally-hosted MongoDB (community). I'm constantly seeing this pop up in my logs: System.NotSupportedException: The MongoDB EF Core Provider now ...
Chris Phillips's user avatar
0 votes
0 answers
45 views

Postman not working with Entity Framework API but browser does

I made a project using Entity Framework and .net7. It's uploaded in a remote server and running on IIS. Using browser or any programming language like Laravel with the APIs works fine but not on ...
Yu_Jain's user avatar
  • 161
0 votes
0 answers
33 views

Entity Framework: How to generate a (not Id) counter that resets each year

I have an entity "JobOrder" in EF that uses "Id" as incremental identifier (on SQL Server DB), with a field "Code" that is actually calculated, once the joborder is ...
laurarana's user avatar
0 votes
1 answer
39 views

Need condition on forloop's one value while updating throught linq

Here is my query. (from t in Context.Tracker where t.TrackerNumber == Guid.Parse(TrackerNumber) select a).ToList().ForEach((x) => ...
Pinky's user avatar
  • 71
1 vote
1 answer
38 views

Entity Framework same schema, different table, one sort function

Is it possible to have 2 different Entity Framework model for 2 different SQL Server Views, which have same schema, and have them go through a single sort function? eg. public class TableOne { ...
James's user avatar
  • 591
0 votes
1 answer
45 views

Share DbContext in Integration Testing

For making my integration tests I am using TestContainer package (SQL Server). I also have a BaseWebApplicationTest class to share some properties like HttpClient and AppDbContext. This is my ...
Skeytor's user avatar
0 votes
0 answers
70 views

Search from SQL Database via FORM on Blazor

I am trying to search data/information in the database using Form in blazor. I tried everything from the net and I can't seem to find the right choice for it. I'm using onion structure in the blazor ...
Loxodonta's user avatar
0 votes
1 answer
42 views

UpdateFromQuery - handling nullable db columns

Does N.EntityFramework.Extensions correctly handle db nullable columns? For example. There is a table MyTable with 2 nullable nvarchar columns: col1, col2. Both columns has values in db filled (not ...
Ilya's user avatar
  • 73
2 votes
1 answer
57 views

NpgsqlException while connecting to Postgres: ERROR: 3D000: odyssey: c16b9035a1f78: route for 'template1.xxx' is not found

I have faced a problem while connecting to a cloud Postgres database. It throws an error: System.Data.Entity.Core.ProviderIncompatibleException: An error occurred accessing the database. This usually ...
Denis Kiryanov's user avatar
0 votes
2 answers
58 views

How do I configure EF Core in Azure Function .NET8-isolated with Entra app authentication?

I have a bit of an issue that causes major problem for me at this point, and I can't seem to find any resolution consulting the docs or in similar questions asked here. I only have this problem when ...
swaglord mcmuffin''s user avatar
-1 votes
0 answers
55 views

foreign key in the code but not in the database [closed]

In the database I have two tables with the field "IDIdentificationDocs". In "IdentificationDocs", this field is a primary key and in the "Document" table, I store this ...
Carlos Alberto Ribeiro Bicudo's user avatar
0 votes
0 answers
74 views

Entity Framework / Linq performance in .NET 4.8 vs .NET 7

I have 2 applications, one running on .NET 4.8 (ApplicationA) and another on .NET 7 (ApplicationB). ApplicationB is the newer more modern version of ApplicationA but server side code is mostly the ...
Yoloshi's user avatar
0 votes
0 answers
36 views

Unable to create a 'DbContext' of type ''. The exception 'Unable to resolve service .Net 8

I am working on an application I have created an API using dotnet ef command line. I have added multiple layers. Now the issue I am facing is to add migrations. Below is the error message and code I ...
Kamran Khan's user avatar
  • 1,109
0 votes
1 answer
68 views

Submit button not inputting values properly

I have a form in cshtml that is inputting into a model but it keeps skipping some value that has been added inside the for code block, specifically the GroupPerDay values <form method="post&...
Trung Đặng Đức's user avatar
0 votes
1 answer
38 views

How to log errors in DB within a transaction that fails with Entity Framework 6

If I'm in the middle of doing a bunch of updates within a transaction, and it throws an exception, I still want to log some information in a table in the same db context so I know what happened. I ...
crichavin's user avatar
  • 4,792
0 votes
1 answer
27 views

C# - Migration failed for solution with 2 projects (DBContext setr in only one project)

Error message: No DbContext was found in assembly 'API_Test_Console'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic. If you take a look at projects ...
Jean Tosta's user avatar
-2 votes
2 answers
144 views

EF Core "An Item with the same key has already been added" error while executing stored procedure with non-unique records

I'm facing an issue when executing a stored procedure via EF Core. The stored procedure returns records that are not unique, and I'm encountering the following error: An Item with the same key has ...
user3449139's user avatar
0 votes
0 answers
48 views

Can not update database model in VS 2022

I have the following problem: I cannot update my database model (.edmx). When I right-click in the model, then “Update model from database” and select my Oracle connection string, the following error ...
Puishi's user avatar
  • 1
0 votes
1 answer
59 views

.NetCore EF - Main query used by sync/async query

So I have a main sync query like: private List<MyCustomClass> Foo() { return _ctx.Table1.Where(...).Select(s => new MyCustomClass { ... }).ToList(); } and I need to use the results of it ...
CodeIT's user avatar
  • 75
0 votes
1 answer
45 views

Visual Studio C#: Update-Database issue

I got a code-first project hosted online (Website). When I run [Update-Database] from the console on Visual Studio, it update my local database but if I change my ConnectionString to the online one, ...
Sigma3Wolf's user avatar
0 votes
0 answers
50 views

Connecting to local SQL Server Express from Docker

I've created a default ASP.NET Core 8.0 Web API project with enabled docker. Now I want to access a SQL Server Express instance on my local machine. If I run the created project in IIS, I can do it (I ...
Unnamed's user avatar
  • 224
0 votes
0 answers
23 views

JetEntityFrameworkProvider.dll doesn't work after installation on Test PC

I am using JetEntityFrameworkProvider.dll to connect to MS access db in windows From c# application. it works fine in development PC, when I make msi installer file with Wix toolset and install it on ...
nnmmss's user avatar
  • 2,932
1 vote
0 answers
63 views

EF 6 and SQL Server synonyms [duplicate]

I have a strange issue with SQL Server synonyms and EF 6. A SQL Server database is set up with tables containing various non-dbo schemas (i.e. AZFSTSA and FMS). I would like the ASP.NET MVC ...
user1718552's user avatar

1
2 3 4 5
1838