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)

19 results in tag: asynchronous

Multi-async in Entity Framework 6?

This is my code:...var banner = context.Banners.ToListAsync() var newsGroup = context.NewsGroups.ToListAsync() await Task.WhenAll(banner, newsGroup); ...But when i called the function from controller. It showed error...A second operation started on this c...
asynchronous entity-framework entity-framework-6
asked by An Hv

EntityFramework Stored Proc Function Import is it possible to read async?

I'm using EF 6.1.1 and Database First. When I import a stored proc into the edmx and generate the DBContext it looks like this:...return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<TestSP_Result>("TestSP", params[]...) ...That returns an O...
asynchronous c# entity-framework entity-framework-6 entity-framework-6.1
asked by oscarmorasu

Entity Framework SaveChanges Async

I am currently working on an audit trail feature and using the entity framework....the current code works but takes long time to run....public class MyDbContext : DbContext { public int SaveChanges() { // get changes from ChangeTracker.DetectChange...
asynchronous c# entity-framework entity-framework-6 task
asked by Milo Cabs

Asynchronously process entities as they are returned from the database engine

In EF 6, I would like to asynchronously process entities as they are returned from the database engine....I know I can call ...ToListAsync()... and ...ForEachAsync()... and perhaps they do what I'm looking for, but I'm not convinced. I think what I am lo...
async-await asynchronous c# entity-framework entity-framework-6
asked by MikeJansen

why i cannot await 'System.Linq.IQueryable

I have the following repository method:-... public IQueryable<TSet> getAllScanEmailTo() { return t.TSets.Where(a=>a.Name.StartsWith("ScanEmail")); } ...which is being called as follow:-...var emailsTo = repository.getAllScanE...
asynchronous c# entity-framework entity-framework-6 linq
asked by john Gu

How do I safely call an async method from EF's non-async SaveChanges?

I'm using ASP.NET Core, and EF Core which has ...SaveChanges... and ...SaveChangesAsync.......Before saving to the database, in my ...DbContext..., I perform some auditing/logging:...public async Task LogAndAuditAsync() { // do async stuff } public o...
async-await asynchronous c# entity-framework entity-framework-core
asked by grokky

Entity Framework Core + SQlite. Async requests are actually synchronous

I have WPF program and I am trying to use EF Core with SQLite there and I found strange behaviour. Even if I call async method like ToArrayAsync() or SaveChangesAsync() it returns already completed task. So it means that operation was actually done synchr...
.net asynchronous c# entity-framework-core sqlite
asked by Ivan Chepikov

Raise async event in EF's DbContext.SaveChangesAsync()

I'm using EF Core, in an ASP.NET Core environment. My context is registered in my DI container as per-request....I need to perform extra work before the context's ...SaveChanges()... or ...SaveChangesAsync()..., such as validation, auditing, dispatching n...
async-await asynchronous c# entity-framework entity-framework-core
asked by grokky

.NetCore WebAPI methods Async or Not with EFCore query

What is considered best(or better) practice to have as default state and why, and what are the real benefits of either?... For example if we have ...Get... method in controller should it be:...public virtual IActionResult Get(int page = 1, int pageSize = ...
asp.net-core async-await asynchronous c# entity-framework-core
asked by borisdj

Deadlock on Linq to Entity Framework Core 2.0 Table

I'm getting what I think to be a deadlock when trying to run a bunch of linq queries in parallel....I am running a ...Task.WhenAll()... on this method:...public async Task<MetabuildScan> GetLatestMetabuildScanAsync(string buildId) { var metabuildScanS...
async-await asynchronous entity-framework-core linq
asked by Window

Why are queries that modify database data awaitable, while queries that only read data not?

I can asynchronously write new rows to the database:...await dbContext.Chatlogs.AddAsync(new ChatMessage(messageString, time, author)); await dbContext.SaveChangesAsync(); ...But what about just reading content from the databse?...string firstMessageEverP...
async-await asynchronous c# entity-framework-core
asked by gaazkam

Return multiple values from a C# asynchronous method

I have worked with asynchronous methods and the methods which return multiple values, separately. In this specific situation, following "GetTaskTypeAndId()" method should be asynchronous and should return multiple values at the same time. How should I mak...
async-await asynchronous c#-7.0 entity-framework-core return-value
asked by Kushan Randima

Entity Framework core 2.1 Using AsNoTracking with multiple Async gives InvalidOperationException: The connection was not closed

I have run two Async methods using Entity Framework 2.1 - one for selecting the total count and another for retrieving page data - and I marked my entity AsNoTracking as following:...var dbContext = new SamuraiAppDataCoreContext(); var query = dbContext....
async-await asynchronous c# entity-framework-core
asked by Mina Matta

How to check if Entity item was added in Async C# MVC Core method

I am writing my own implementation of IUserStore and IUserPasswordStore and I need to prepare async method ...CreateAsync... which will return ...IdentityResult.... So far I have this:... public async Task<IdentityResult> CreateAsync(User user) { ...
asp.net-core asp.net-identity async-await asynchronous entity-framework-core
asked by RaV

How do I do an async query without enumerating the data?

I'm trying to work out how to write a generic async ...GetAll<T>... database method in Entity Framework Core without enumerating the data. I want ...GetAll<T>... to be async, but don't want it to enumerate the data, so that I can add a ...Where... method ...
asynchronous c# entity-framework-core
asked by Avrohom Yisroel

How can I return IQueryable<TEntity> object from a mock object?

I am trying to tell a method ...GetAll()... on a mocked object ..._portalUserRepositoryMock... to return an object of type ...IQueryable<TEntity>.... I know it is of this type because the method in the class to be tested returns this type....I've not been...
.net-core asynchronous c# entity-framework-core nsubstitute
asked by user54287

How to fix .Net Runtime unhandled exception

I had a function which I need to Refresh the data grid view. When I deploy the program it automatically close the program....I have a MSSQL Server in my side. I tried to fix my function several times but it only works fine in my environment....Here is my ...
asynchronous c# entity-framework entity-framework-core wpf
asked by Nicko Rother M. Belir

Asynchronously saving to multiple tables in a single SQL Server Db

I was able to populate multiple tables of a database in parallel using Task.WhenAll(tasks). I have a generic method for each table:...var tasks = new List<Task>() { CheckNewItems<S, T>(async () => await GetPrimaryKeys<S, T>(), ...
async-await asynchronous c# entity-framework-core
asked by Practical Programmer

How to create an asynchronous repository with EF Core?

I'm trying to abstract EF Core with a repository and can't figure out how to make it asynchronous. This is the synchronous version:...public class UserRepository { private DbSet<User> users; public UserRepository(ApplicationDbContext context) ...
asynchronous c# entity-framework-core linq sql-server
asked by Gur Galler

Page 1 of 1
  • 1

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!