Skip to content

A lightweight generic mock server, built with ASP.NET Core, Entity Framework Core, and SQLite database.

License

Notifications You must be signed in to change notification settings

AngeloDotNet/NET-GenericMockServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

.NET 8 Minimal API Mock Server

🛠️ Dependencies

  • .NET 8 SDK
  • Microsoft.EntityFrameworkCore.Sqlite
  • Bogus

📚 Endpoints (examples after startup)

Method Endpoint
GET /api/products
GET /api/products/{id}
POST /api/products
PUT /api/products/{id}
DELETE /api/products/{id}

⚙️ How to extend with a new entity

  1. Add the class in Models (inherit EntityBase or add long Id property).
  2. Register the entity in the AppDbContext (modelBuilder.Entity();).
  3. (Optional) Implement IEntityFaker for the specific faker and register it in Services.
  4. In Program.cs, add app.MapEntityEndpoints<YourEntity>("yourentities");

💡 Note

  • The GenericRepository uses DbContext.Set() and FindAsync(id) to search by ID; if your entity uses a different pk name, adjust the repository.
  • The DefaultEntityFaker attempts to populate common properties (string, number, DateTime). You can override it by registering a type-specific faker.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

⭐ Give a Star

Don't forget that if you find this project helpful, please give it a ⭐ on GitHub to show your support and help others discover it.

About

A lightweight generic mock server, built with ASP.NET Core, Entity Framework Core, and SQLite database.

Topics

Resources

License

Stars

Watchers

Forks