December 2019
Intermediate to advanced
528 pages
11h 19m
English
The following code sets up the in-memory database inside the DbContext options and creates a new context using these options. This is exactly the same DbContext that is created when the program runs with real data, but is stored in memory:
var options = new DbContextOptionsBuilder<ResearchContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .EnableSensitiveDataLogging() .Options; var researchContext = new ResearchContext(options); var researchController = new ResearchController(researchContext);
Read now
Unlock full access