Skip to main content
Filter by
Sorted by
Tagged with
Best practices
0 votes
1 replies
49 views

I am currently developing a module for an ASP.NET Core Web API that uses EF Core to talk to MySQL. The problem is I have no idea how to make EF Core fill the entityId property. Here is the example ...
Sannnekk's user avatar
  • 103
0 votes
0 answers
68 views

I'm using EF Core 9 and I'm trying to run a migration against a copy of our production database. On our local development databases everything works, but on the production copy the migration fails ...
heaxyh's user avatar
  • 633
1 vote
0 answers
45 views

I've been struggling for two days with a PostgreSQL enum type issue in Entity Framework Core. Despite all my configuration, EF Core keeps trying to send a string (`text`) to an enum column. The ...
Мирон Никитин's user avatar
0 votes
1 answer
96 views

I have a web app using code-first EF Core. One of the controllers needs to run what should be a simple query (basically SELECT TOP 1 * FROM companies WHERE id = @id; in EF terms, var data = await ...
minnmass's user avatar
  • 261
1 vote
1 answer
80 views

Microsoft have changed ExecuteUpdateAsync to accept non-expression setters parameter in NET 10. Now it works this way: await context.Blogs.ExecuteUpdateAsync(s => { s.SetProperty(b => b....
Stanislav Gordenko's user avatar
-1 votes
0 answers
48 views

Given a class A, and a class B, where class A holds a reference to class B, and where some logic in A depends on some state in B, how can i configure EF Core to make sure B has not changed when ...
Claude Hasler's user avatar
Advice
0 votes
5 replies
105 views

I have the following use case: the database contains a row with a nullable column, and I would like to request only that column value from the database for a single row. This can easily be done using ...
R. Hoek's user avatar
  • 1,135
2 votes
1 answer
75 views

I just got my .Net 9 Maui app working with EF Core and SQLite. I have one row of data in the database that looks like this: I have a simple query that runs when the app loads. The repository method ...
USMC6072's user avatar
  • 832
0 votes
2 answers
72 views

I'm trying to configure a new Maui app to use EF and Sqlite following this guide: https://learn.microsoft.com/en-us/dotnet/maui/data-cloud/database-sqlite?view=net-maui-9.0 For a long time I got an ...
USMC6072's user avatar
  • 832
1 vote
1 answer
60 views

I have a simple DbFunction to convert a date string column (mm-dd-yyyy) to datetime before ordering. The DbFunction is set up in the DatabaseContext class as follows. [DbFunction("...
FLash's user avatar
  • 804
3 votes
2 answers
115 views

I'm building an ASP.NET Core Web API where I need to upload a file to Azure Blob Storage and update an EF Core entity in a single request. The challenge is that EF Core supports transactions, but ...
Codisattva's user avatar
2 votes
1 answer
119 views

I'm working on a .NET 8 project using Microsoft.EntityFrameworkCore 8.0.7 with PostgreSQL as the database. I have a table that contains a jsonb column, and I'm using AutoMapper to map a DTO to the ...
Alparslan ŞEN's user avatar
7 votes
1 answer
205 views

I'm trying to use Linq to generate a SQL command like this return await query.GroupBy(x => new { Id = x.xId, ...
A.C.'s user avatar
  • 93
4 votes
1 answer
301 views

Have a rather simple LINQ query: var objectExternalIds = new string[] { "abc" }; var query = from order in Context.Order join apointment in Context.Appointment on order.Nr equals ...
Jester's user avatar
  • 3,411
0 votes
0 answers
56 views

I have a nested entity, defined like this: entity.OwnsOne(e => e.EncryptedElements, o => { o.ToJson(); o.OwnsMany(x => x.Values, o => { o.Property(x ...
ZorgoZ's user avatar
  • 3,758
2 votes
1 answer
55 views

The entities are: public class Department { public int Id { get; set; } public string Name { get; set; } public IList<Employee> Employees { get; } = new List<Employee>(); } ...
yogihosting's user avatar
  • 6,386
3 votes
1 answer
247 views

I am trying to project the result of the following query into EF Core 8 entities: select foo.* , (case when hst.Id is not null and foo.OtherColumn = 1 then 42 else null end) as Bar ...
Ian Kemp - SO dead by AI greed's user avatar
1 vote
2 answers
237 views

I have a code snippet that uses let with a where clause. private List<string> Example2() { var query1 = from c in _context.Customers let custPurchases = _context.Purchases....
Romanov Nikita's user avatar
0 votes
1 answer
98 views

I have the following entities Film: using System.ComponentModel.DataAnnotations.Schema; namespace MyWebAPIApplication.Entities { public class Film : Base { string Title { get; set; } ...
James's user avatar
  • 1,345
1 vote
0 answers
87 views

I am very new to development with ORMs. In my project, where I use Entity Framework Core, I want to create a class that would encapsulate whole interaction with database, i.e. through which I would ...
Alex's user avatar
  • 11
2 votes
1 answer
370 views

I am using Entity Framework Core and I want to enforce custom naming conventions automatically for PKs, FKs, indexes, and sequences during migrations. My naming rules are as follows: Primary key (PK):...
Alparslan ŞEN's user avatar
1 vote
1 answer
461 views

private readonly IMapper _mapper; public CreateDepartmentRequestHandlerTests() { var config = new MapperConfiguration(cfg => cfg.AddProfile(new CreateDepartmentProfile())); _mapper = ...
Saidabror's user avatar
1 vote
0 answers
67 views

In Entity Framework Core 9.0.9, the query builder fails with SQLite Syntax builder.Services.AddDbContext<MyDbContext>(fun options -> options.UseSqlite(connectionString) |> ignore It ...
Kalju Pärn's user avatar
1 vote
2 answers
139 views

How do I use Reverse to reverse the order of the results of a LINQ to Entities query? Something like: var result = dbContext.Users.Where(a => a.Name != null).Reverse();
Protector one's user avatar
0 votes
0 answers
88 views

I want to create a custom admin user from the DbContext, so that when my microservices are started in Docker Compose, an admin user is automatically set up by default when migrations are applied to ...
Paolo Giacosa's user avatar

1
2 3 4 5
471