-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bulk updates/deletes: Support in-memory provider #29376
Comments
@Sebazzz it's very unlikely that we would implement this; the InMemory provider cannot implement all the features of a relational database, and is generally unsuitable as a testing double (fake). See this overview, or, for more depth, this page. |
@roji One piece of feedback I'd like to give: The InMemory provider has the advantage of (1) ease of use (no set-up needed), and (2) it does not enforce many of the constraints a Sqlite or SqlServer database would. That makes it extremely useful for unit tests in CSRF/Clean Architecture scenarios for instance. If it was possible to create a Sqlite in-memory database, but with the same behaviour as in-memory - I'd use it in an instant and that would make the InMemory provider obsolete for me. |
@Sebazzz what kind of constraints does SQLite in-memory have that make InMemory a better choice for you? |
@roji Think like required fields and navigation properties for instance (though strangely in some cases the InMemory provider also wants some fields for instance, mostly on string fields). I can just "save" a few entities and don't need to bother with a lot of these constraints and I got my set-up for a test. |
@Sebazzz you should be able to bulk-configure your model to make all properties nullable when SQLite is used, or something similar. Though I'm not sure it's a great idea to be leaving properties/columns empty when in your real application they can't be nullable (regardless of InMemory vs. SQLite) - generally you want your testing model to approximate your real one. |
For unit testing it would be great if the in-memory provider could also support bulk updates and deletes from #795, as this simplifies testing greatly.
Currently it fails with a rather obscure error message:
Note that this owned type is also included in the expression tree apparently, which makes it even more difficult to understand.
The text was updated successfully, but these errors were encountered: