Add UseDummyData extension for SQLite in-memory test blog posts #472
+213
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Developers need pre-populated blog posts to test pagination, navigation, and search without manual data entry. In-memory SQLite loses data on restart, making this particularly painful during feature development.
Changes
DummyDataOptions: Configurable number of blog posts (default: 20)DummyDataSeeder: Hosted service that seeds test data on startup with realistic titles, tags, dates, and contentUseDummyData()extension: Uses SQLite in-memory database with the existing SQLRepository<>implementationProgram.cswhenIsDevelopment()Implementation
Uses SQLite in-memory with shared cache (
DataSource=file::memory:?cache=shared) and the existingRepository<>fromLinkDotNet.Blog.Infrastructure.Persistence.Sql. Data is seeded via a hosted service on application startup.Usage
Called after
AddStorageProvider()in the service registration chain - removes existingIRepository<>registrations and sets up SQLite in-memory with the SQL repository.Screenshot
20 blog posts with realistic titles, descriptions, tags, and dates. Fixed random seed ensures reproducible test data across sessions.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.