How to refresh Entity Framework Core DbContext of ASP.NET Core project when connection string in web.config is changed?
I have an ASP.NET Core 8 project with Entity Framework Core. The connection string is taken from web.config
in the root folder. While debugging in Visual Studio 2022, I enabled Hot Reload. I have figured out way to refresh DbContext
when hot reload is triggered.
EF Core : error while inserting row in database with FK Constraint failure
I have an endpoint that instatiates a class then add tasks to this and finally save in database:
How to insert a movie with a list of existing unique genres (with EF Core many-many relationship)?
I get the following errors when I try to insert a movie with a list of unique genres.
Why is my code not returning any records? Even though there are rows found. (Entity Framework Core)
using Binus.WS.Pattern.Entities; using Microsoft.EntityFrameworkCore.Metadata; using SSG5.C1.BSQWebAPI.Model; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using Microsoft.Extensions.Logging; namespace SSG5.C1.BSQWebAPI.Helper { public class ElectricHistoryHelper { private static readonly ILogger<ElectricHistoryHelper> _logger = LoggerFactory.Create(builder => builder.AddConsole()).CreateLogger<ElectricHistoryHelper>(); public static List<ElectricHistory> GetElectricHistory(ElectricHistory model, string binusianId) { // Fetch the active period ID var PeriodActive = EntityHelper.Get<MsPeriod>(t => t.AuditedActivity != “D” && […]
AddRange method not adding in the order listed in excel file
I have 2 excel files, reading them into List of model and AddRange to database however AddRange method not adding in the order listed in excel file
Entity Framework Core is logging every query to the event log
This is strange: I have published a .NET Core 8 web application that uses Entity Framework Core to access a SQL Server database.
EntityFramework core is logging every query to the event log
this is strange…. I have published a .NET Core 8 web application that uses Entity Framework core to access a SQL Server database.
Sort EF Core results by distance from location using lat and lng
I have a table that contains lat and lng fields.
Now I want to sort this table’s data based on a given location’s lat and lng so that the closest location is displayed first and the rest are sorted based on the same principle.
Shared Struct for Runtime Data Between Service & API Controller Entity Framework Core
First off I’ll admit I may be quite off the mark here, if that’s so or there is a better way of what I need to achieve I’m open to suggestions.
How do I separate seeding data from migration code in order to reduce the size of .Designer files
We have a large business application that has large amount of seed data in Entity Framework Core 8. DbContext
is a separate library that is linked into web application as a nuget
package. We apply seed data as part of migrations (in ef database update
).