zzz projects Entity Framework Core EF Core
Home Articles Knowledge Base Online Examples
  • Home
  • Articles
  • Knowledge Base
  • Online Examples

Entity Framework Core - Knowledge Base (KB)

6642 results

EF Core Update updates all columns even though only one has changed

I'm kind of new to using EF Core. It was my understanding that EF Core has a "Change Tracker" that looks at the data to see what columns have been modified and builds a SQL UPDATE statement that only updates the modified columns, as described in an answer...
c# entity-framework-core
asked by JoeD

EF Core Buffered load of Included entities

I have a query with Include:...dbContext.Set<Person>().Include(x => x.Events) ...There will be 10s of Persons, but 10000s of Events for each Person....I am looking for a generic buffering solution to not use too much memory at any given time....If I use S...
entity-framework-core
asked by Jakub Fojtik

How can I convert Sql query to Linq and its equivalent with Join() method in Entity Framework Core

select a.* from Article a join ArticleTag at on a.Id = at.ArticleId join Tag t on at.TagId = t.Id where t.Id=8 ...Also I have access to ...IQueryable<Article>..., ...IQueryable<Tag>...and ...IQueryable<ArticleTag>... objects....How ...
c# entity-framework-core linq linq-to-sql sql
asked by Said Roohullah Allem

assign two classes to a generic constraint at runtime

I want to assign two classes to generic constraint at runtime using an OR condition. I don't know if it is possible or not, as I am relatively new to all this....public interface IGenericRepository<TEntity> where TEntity : Employee Department ...I want to...
asp.net-core-mvc c# entity-framework-core
asked by Nihal Singh

Linq To Entities: String.Contains a list

I am using ...ASP.net Core 3.0... with ...Entity Framework Core 3.0... and ...Pomelo.EntityFrameworkCore... provider for ...MySQL..., I need to query all the users that are from specific Towns. Lets say for example I have a list of strings called ...targe...
c# entity-framework-core linq pomelo-entityframeworkcore-mysql
asked by Hamza Khanzada

Querying distinct columns across rows filtering by another column

I'm working on a project using Linq and Entity Framework Core. ...I'm struggling with a query. ...I have two data access models....public class JobPost { public int Id {get;set;} public string RoleTitle { get; set;} public Domain Domain1 {get;set;...
entity-framework entity-framework-core linq linq-to-entities sql
asked by arif

EF Core sum on nested collection's properties does not work

My database has the following structure: One User can have many Accounts. One Account can have many Transfers....This is the map configuration. I want to store in my DTO information about each user and his total savings in every account. (the code below r...
c# entity-framework-core
asked by Tony Troeff

Recommended way of copying/managing data in my database on startup in .net core/ ef core?

The gist of my situation is that I'm dealing with a big database, and depending on the contents of it my code could do all kinds of unexpected things. The data is large, but it's not expected to change heavily any time soon, it's all in a single database ...
asp.net-core entity-framework-core postman sql-server
asked by Yori Dj

Why is the code inside the method executed twice?

The code inside the ...CustomerRepository.GetCustomers()... method is executed twice.... Why is this happening?...  ... In the picture, I showed the steps for executing the code inside the method....   ...Description.... The code comes in step "5"....
.net-core c# entity-framework-core
asked by koverflow

Any way to use method in EF Select extension?

I have method which returns a ViewModel async:... public async Task<CardUserBindingViewModel> GetCardUserBindingViewModel(int cardId) { /// ... creditStatus, remainCreditDays return await Task.Run(() => new CardUserBindingVi...
c# entity-framework-core linq
asked by Mehdi

Oracle DB with .NET Core Using ODP.Net Provider - How to set the Schema

Having trouble getting things to work with an Oracle Database in .NET Core. ...I am able to create a connection to the database.... My problem seems to be when I try to execute a statement. I first was using EF Core with a DbContext to retrieve a single...
.net-core entity-framework-core odp.net oracle
asked by BioData41

IsNumeric in EF Core

Is there an equivalent of IsNumeric in EF Core or by using linq or Dynamic Sql or similar? ...I am trying to get only the rows with numeric values from a nvarchar column.
entity-framework-core
asked by Fred

Setting a column unique null without being an index in .NET EF Core

I would like to add a field to a table that should be unique, but is not required (so it can be null) and it is not an index. This is doable with SQL, something like this in mysql:...CREATE TABLE MyTable ( ... field VARCHAR(255) UNIQUE ... ) ...I tr...
.net-core asp.net-core c# entity-framework entity-framework-core
asked by Tiago Mendonça

How do I fill in an ignored field inside OnModelCreating?

I use the same entity in two DbContexts....public class ActualDbContext : DbContext { public DbSet<Doc> Docs { get; set; } } public class ArchivedDbContext : DbContext { public DbSet<Doc> Docs { get; set; } } public class Doc { ... } ...How ...
c# ef-core-3.1 entity-framework entity-framework-core
asked by Michael Zagorski

ASP.NET Core + Entity Framework Core + SQLite Creating initial migration throws error

I am doing a ASP.NET Core beginner tutorial on Udemy. The task is to create a Code First SQLite database and I want to create a Initial migration which is failing. Below I describe the steps I have made....I have installed the packages ...Microsoft.Entity...
asp.net-core ef-migrations entity-framework-core sqlite
asked by canvee

Use array of ints parameter in FromSQL query and Where In clause

I have a list of ints:...var ids = new List { 10, 20 };...And I need to find Users with that ids:...context.Users.FromSqlInterpolated($@" select Users.* where Users.Id in ({String.Join(',', ids)})" ...But I get the following error:...'Conversion fai...
entity-framework-core entity-framework-core-3.1 linq-to-entities
asked by Miguel Moura

I get a an error when the Date is null but cannot understand why and how to fix it

This is driving me crazy:... using (var context = new aContext()) { _Paz = context.TPaz .Where(a => a.CodPaz == _PazV.CodPaz) .FirstOrDefault(); } ...I have 2 different row...
entity-framework-core linq null sql-server
asked by Massimo Savazzi

Duplicate table created when adding IdentityUser as foreign key in ASP.NET Core 3.1

I am using PostgreSql as my DB. I am trying to add a foreign key to the user's table but instead of that a duplicate ...IdentityUser... table is being created....I have inherited ...IdentityDbContext<IdentityUser>... for ...ApplicationDbContext... whose c...
asp.net-core asp.net-identity asp.net-mvc c# entity-framework-core
asked by Akshay

EF Core - how to audit trail with value objects

I'm trying to implement an Audit Trail (track what changed, when and by whom) on a selection of classes in Entity Framework Core....My current implementation relies on overriding OnSaveChangesAsync:...public override Task<int> SaveChangesAsync(bool accept...
c# entity-framework-core
asked by Simopaa

System.AggregateException in Program.cs in ASP.NET Core MVC

I have an ASP.NET Core MVC application which uses Entity Framework Core O/RM. I am implementing generic repository pattern in my application. There are two entities, ...Employee... & ...Department.... There is one context class ...EmployeeDepartmentDetail...
asp.net-core-mvc c# dependency-injection entity-framework-core
asked by Nihal Singh

Page 324 of 333
  • ««
  • «
  • …
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • …
  • »
  • »»

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Get monthly updates by subscribing to our newsletter!
SUBSCRIBE!