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)

14 results in tag: in-memory-database

How to isolate EF InMemory database per XUnit test

I am trying use InMemory EF7 database for my xunit repository test. ...But my problem is that when i try to Dispose the created context the in memory db persist. It means that one test involve other. ...I have read this article ...Unit Testing Entity Fram...
.net .net-core c# entity-framework-core in-memory-database
asked by Ivan Mjartan

Validating entities using data annotations or fluent api in EF 7.0 (In Memory)

I can't verify and test my database by in memory providers. for example I set these properties to required : ...public abstract class Log { #region Properties public Guid Id { get; set; } [Required] public string ClientIp { get; set; } ...
data-annotations entity-framework-core in-memory-database mstest unit-testing
asked by paradise_human

How to suppress InMemoryEventId.TransactionIgnoredWarning when unit testing with in-memory database with transactions?

I'm using an EF Core in-memory database and I'm trying to run a unit test on a method that uses transactions:... using (var transaction = await _context.Database.BeginTransactionAsync()) { _context.Update(item); result = await _cont...
asp.net-core c# entity-framework-core in-memory-database
asked by tomRedox

How to unit-test transactions in Entity Framework Core?

I have a method that does some work in a transaction:...public async Task<int> AddAsync(Item item) { int result; using (var transaction = await _context.Database.BeginTransactionAsync()) { _context.Add(item); // Save the item...
entity-framework-core in-memory-database sqlite transactions unit-testing
asked by tomRedox

Raw sql with EF Core and in-memory db provider

One of my API routes uses a raw sql ...merge into... command in order to do an atomic upsert operation, and in my automated tests I've got a ...TestServer... instance that uses the in-memory db provider. It gives me an error, probably because the in-memor...
entity-framework-core in-memory-database sql
asked by gzak

Unit Tests vs Integration tests: Entity Framework Core In memory

I am currently working on an ASP.NET Core 2.0 Web API with EF Core 2.0. I plan to implement the Repository + UnitOfWork pattern and I've already created the abstractions, interfaces etc. Since I'm following a TDD approach I want to write tests on those in...
asp.net-core c# entity-framework-core in-memory-database unit-testing
asked by dimlucas

Testing against Entity Framework InMemory

I'm currently testing an ...Entity Framework's...DbContext... using the ...In-Memory Database.... ...In order to make tests as atomic as possible, the ...DbContext... is unique per test-method, and it's populated with initial data needed by each test....T...
c# entity-framework-core in-memory-database unit-testing
asked by SuperJMN

Problem adding entity with Id = 0 in EntityFramworkCore.InMemory provider

Following code throws exception:...System.InvalidOperationException: The instance of entity type 'DimEntity' cannot be tracked because another instance with the same key value for {'EntityEntityId'} is already being tracked. When attaching existing ...
c# entity-framework-core in-memory-database
asked by Liero

Why are separate DbContexts modifying the same DbSet during Unit Tests?

Enviornment:...Xunit 2.3.1...Microsoft.EntityFrameworkCore.InMemory 2.1.0...I have three test methods in three different classes that when run separately pass but when run together only one will pass and the other two will fail. Then when the two are run ...
c# entity-framework-core in-memory-database unit-testing xunit
asked by JohnOsborne

C# awaited entity framework core in memory operation is very slow when performed within loop

I have this kind of code that I am trying to unit test with an in memory ef core database....public async Task<int> UpdateHistoricalWeatherDataAllLocationsAsync() { var regions = DalContext.Region.ToList(); var allInsertAmounts = new ...
c# entity-framework-core in-memory-database
asked by Craig

Using EntityFrameWorkCore and SqlLite in memory I get "no such table: ControlGroup" error

The context of my problem is, I want to create some unit tests to my application which executes some relational-specific code, so I can't use the standard ....UseInMemoryDatabase(databaseName: dbContextName)... I changed it to ....UseSqlite("DataSource=:m...
c# entity-framework-core in-memory-database sqlite
asked by RagnaRock

How to ensure that Entity Framework Core InMemory database is created per test method?

Dears, I am trying to create integration tests that tests my API controller using entity framework core in-memory database provider. I created ...CustomWebApplicationFactory... that configure my services, including my db context according to ...official d...
asp.net-core entity-framework-core in-memory-database integration-testing
asked by yo2011

EF Core in memory, delete unit testing giving error: entity already tracked

I am working with entity framework core in memory to test my code.I created in memory context and added data. I have delete method which is going to delete record with id=1. Test method is throwing error following error:...The instance of entity type 'cat...
entity-framework-core in-memory-database
asked by Mmd565

EFCore Bulk Insert & SQLite In Memory: no such table: INFORMATION_SCHEMA.COLUMNS"

I'm using ...EFCore BulkExtensions... 2.5.0 with Entity Framework Core 2.2.3 and EFCore.SQLite 2.2.6....I have code like this:...// Repo that throws exception on BulkInsert public class UserRepository { private readonly IDbContextProvider<ReportContext...
c# entity-framework-core in-memory-database sqlbulkcopy sqlite
asked by Philip Pittle

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!