EntityFramework.Docs
EntityFramework.Docs copied to clipboard
Add a constructor for testing example does not mentiond "TContext"
The example given:
public class BloggingContext : DbContext
{
public BloggingContext()
{ }
public BloggingContext(DbContextOptions<BloggingContext> options)
: base(options)
{ }
Does not line up with the text following it:
DbContextOptions<TContext> tells the context all of its settings, such as which database to connect to. This is the same object that is built by running the OnConfiguring method in your context.
Since TContext is not mentioned in the example code
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: c95e5c7e-882f-76f7-5301-2a5d1ede39d3
- Version Independent ID: 8754aa99-67a7-98ac-a51e-0ba995f96414
- Content: Testing with InMemory - EF Core
- Content Source: entity-framework/core/miscellaneous/testing/in-memory.md
- Product: entity-framework
- GitHub Login: @rowanmiller
- Microsoft Alias: divega
I misunderstood the syntax. <TContext> is a DbContextOptions parameter that BloggingContext satisfies.
My mistake. Closing this.