码迷,mamicode.com
首页 > 数据库 > 详细

EF Core In-Memory Database Provider

时间:2018-03-19 13:28:35      阅读:287      评论:0      收藏:0      [点我收藏+]

标签:efault   int   port   amp   gen   microsoft   com   .net core   using   

原文链接

 

This can be useful for testing, although the SQLite provider in in-memory mode may be a more appropriate test replacement for relational databases.

 

Supported Database Engines

  • Built-in in-memory database (designed for testing purposes only)

Supported Platforms

  • .NET Framework (4.5.1 onwards)

  • .NET Core

  • Mono (4.2.0 onwards)

  • Universal Windows Platform

 

 

Testing with InMemory

The InMemory provider is useful when you want to test components using something that approximates connecting to the real database, without the overhead of actual database operations.

InMemory is not a relational database

EF Core database providers do not have to be relational databases. InMemory is designed to be a general purpose database for testing, and is not designed to mimic a relational database.

Some examples of this include:

  • InMemory will allow you to save data that would violate referential integrity constraints in a relational database.

  • If you use DefaultValueSql(string) for a property in your model, this is a relational database API and will have no effect when running against InMemory.

For many test purposes these differences will not matter. However, if you want to test against something that behaves more like a true relational database, then consider using SQLite in-memory mode.

 

EF Core In-Memory Database Provider

标签:efault   int   port   amp   gen   microsoft   com   .net core   using   

原文地址:https://www.cnblogs.com/panpanwelcome/p/8600808.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!