Search code examples
c#entity-frameworkentity-framework-extensions

C# Does UpdateFromQuery work with InMemory DB?


Does UpdateFromQueryAsync work with Sql InMemory Database? It does need currently update in my current unit test.

 var options = new DbContextOptionsBuilder<StoreContext>()
       .UseInMemoryDatabase(databaseName: "Test")
       Options;

 using (var webStoreContext= new WebStoreContext(options))
 {
      await webStoreContext.Set<Product>().UpdateFromQueryAsync(x => new Product
      {
         ProductType= 'Electronics'
         UpdateDate = DateTime.Now
      }

Resource:

https://entityframework-extensions.net/update-from-query


Solution

  • Yes,

    UpdateFromQuery is compatible with InMemory database.

    If you get an issue, I recommend you to report it here: https://github.com/zzzprojects/EntityFramework-Extensions/issues with a runnable example that show the error.