726 questions with Entity Framework Core tags

Sort by: Updated
1 answer

AddDbContext<TContextService, TContextImplementation> don't use DI to create the db

In my project I have created this DbContext derived class: public class SqliteContext : DbContext, IRepoContext { private readonly string _fullname; public SqliteContext() { _fullname = SqliteHelpers.CreateDbFullName(); } …

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
726 questions
asked 2021-01-07T10:45:45.907+00:00
Marco Segurini 21 Reputation points
commented 2021-01-12T09:05:32.047+00:00
Daniel Zhang-MSFT 9,621 Reputation points
2 answers

Linq Error when migrate entityframeworkcore 2.2 to 3.0

Hello, i am migrating from netcore 2.1 to 3.1. of a solution hosted on Azure. I have encountered many errors due to entityframeworkcore 3. Queries such as DBe.BmsListaInfrastructure.Where (e => e.Amministration == Administration) .ToList (); …

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
726 questions
asked 2020-12-15T18:27:20.663+00:00
Marco Salvatori 191 Reputation points
answered 2020-12-17T14:25:01.817+00:00
Marco Salvatori 191 Reputation points
4 answers One of the answers was accepted by the question author.

How to pass datatable from c# class to MSSQL Server stored procedure using Entity Framework Core 5.0.1.

I have a data import application written in .Net Framework to migrate to .Net Core. The application uses a c# class to pass a datatable as an input parameter to a MSSQL server stored procedure. The code in EF6 works fine and is pasted below. …

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
726 questions
asked 2020-12-10T12:53:30.587+00:00
Williamson, Stephen 21 Reputation points
accepted 2020-12-14T15:19:11.56+00:00
Williamson, Stephen 21 Reputation points
2 answers

Code first Unique constraint on multiple columns

Say I want a Microsoft SQL Server entity as follows: CREATE TABLE [dbo].[Entity]( [ID] [int] IDENTITY(1,1) NOT NULL, [COL1] [nvarchar] NOT NULL, [COL2] [nvarchar] NULL, [COL3] [nvarchar] NULL, CONSTRAINT [PK_Entity] PRIMARY KEY CLUSTERED Then…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
726 questions
asked 2020-12-06T17:22:22.337+00:00
EuroEager2008 171 Reputation points
commented 2020-12-10T08:00:42.027+00:00
Daniel Zhang-MSFT 9,621 Reputation points
1 answer One of the answers was accepted by the question author.

DbContext lifetime in desktop app with SQLite

I am creating a small data-driven desktop application using .NET 5 with WPF, ReactiveUI, Dynamic Data, and EF Core 5. The app uses a local SQLite database to store all persisted state, and relies heavily on dependency injection. I would like to share…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
726 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,717 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,389 questions
asked 2020-12-04T01:26:51.93+00:00
mtrainham 21 Reputation points
accepted 2020-12-04T18:28:49.253+00:00
mtrainham 21 Reputation points
1 answer One of the answers was accepted by the question author.

Having trouble with foreign key in entity, can't track because the FK is already part of another object

Scenario: I have an entity that is central to the business, let's call it Company. Entity Foo has FK CompanyID, as does entity Bar. If, within the same context, I retrieve Foo and create an instance of Bar, then try…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
726 questions
asked 2020-12-01T00:34:30.12+00:00
David Craig 31 Reputation points
commented 2020-12-02T01:17:45.293+00:00
Daniel Zhang-MSFT 9,621 Reputation points