All Questions
Tagged with sql-server entity-framework-core
1,712
questions
0
votes
1
answer
35
views
EF Core: what exactly is the command timeout measured on?
I was previously downloading via EF millions of records without encountering any timeouts, however, after adding a WHERE clause to limit the download to only a few thousand records, I am frequently ...
2
votes
0
answers
47
views
Join tables with Entity Framework Core ignores join filter
Recently, I upgraded my project to use Entity Framework Core instead of Entity Framework. I have a query in my project that has recently started timing out.
When I checked the profiler, I noticed that ...
1
vote
2
answers
90
views
Transform DateTime field to provided format in where clause
I'm trying to integrate a search function in my datatable in Asp.Net Core. I load the content dynamically with a query to my MSSQL server. As the database table content will increase drastically over ...
2
votes
1
answer
40
views
Entity property is set prior to SaveChangesAsync then sometimes is saved to the database as null, and changed to null in the entity
I have an intermittent problem. I have a C# API project that reads an entity from the database, updates its properties, then calls DbContext.SaveChangesAsync. The entity has a nullable int ...
0
votes
1
answer
63
views
Many-to-many relationship update in EF Core
In my two classes I created a many-to-many relationship:
public class Author
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[DisplayName(&...
0
votes
1
answer
66
views
Issue with LINQ Query in Async Method: 'The LINQ expression could not be translated'
I have an asynchronous method in C# that retrieves a list of users with various nested includes and filters. The method works fine when I don't pass the arbsResponse parameter, but I encounter an ...
0
votes
2
answers
64
views
Moving database contexts to library project results in "FileNotFound" exception
I have a .NET Core 7 solution EIT which had only 1 project: EIT. This project uses Entity Framework Core to model and access the database. This worked fine.
Now I want to add several Windows services ...
0
votes
0
answers
71
views
Entity Framework Core Unidirectional many-to-many not working
I want to use a Unidirectional many-to-many relationship but I can't seem to get it to work.
I use EF Core 8.0.6 and recreated the example (https://learn.microsoft.com/en-us/ef/core/modeling/...
2
votes
2
answers
191
views
What's the best way to update ~500 entities with EF Core? [closed]
Right now I loop through each entity and call ExecuteUpdateAsync then after the loop I call CommitAsync, but I'd like to know if there is a better way for updating ~500 records?
I see this bulk ...
0
votes
1
answer
56
views
In Entity Framework how should I limit string length to no greater than 12000 characters
I tried the obvious...
[StringLength(12000)]
public string Instructions { get; set; }
...(also tried MaxLength) but when I run add-migration I get empty Up() and Down() methods. The only impact of ...
0
votes
1
answer
47
views
System.Data.SqlClient.SqlException but table is exists in the database [duplicate]
I use Quartz to perform background tasks in my .NET core project. Here is the code for my Quartz:
public class ReportsChangesJob : IJob
{
private readonly IReportsService _reportsService;
...
1
vote
2
answers
62
views
Why do I get the SpecialityName as null here?
I am working with ASP.NET Core And Entity Framework, and when I request this controller I get this.
The problem in using the FromSql method is that it returns the SpecialityName as null, when the same ...
1
vote
1
answer
97
views
How to properly manage and dispose SqlConnection with SqlCredential in EF Core using Dependency Injection?
I am working on an ASP.NET Core project where I am using SqlCredential for database authentication, provided by a SqlCredentialProvider which is designed as a singleton to ensure a single instance ...
0
votes
0
answers
29
views
Why are the relationships in the table not working properly? [duplicate]
There is a database in the project and I want my user to be able to create code sections and they are saved in the database, also the user can like other people's code, and these liked CodeSnippets ...
0
votes
0
answers
59
views
_dbContext.Add query error: Invalid column name
I have two model classes that relate many-to-one to each other:
public class AlertRule: Identity
{
public long RuleId { get; set; }
[ForeignKey(nameof(RuleId))]
public virtual SepRuleBase ...