Skip to content

Test project intended to create API for data-focused apps in the future. Class libraries for API, Blazor for UI and testing

Notifications You must be signed in to change notification settings

markdicks/Test_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧪 Test API (.NET 8 + EF Core)

This is a clean, modular .NET 8 API project using:

  • Entity Framework Core 9
  • Repository & Service Pattern
  • SQL Server with customizable schema
  • Layered architecture (Data, Repo, Service, Web)

🧱 Architecture

OA.Web         => API entry point (ASP.NET Core)
OA.Service     => Business logic / Service Layer
OA.Repo        => Data access / Repositories + DbContext
OA.Data        => Models / Entities / BaseEntity
  • Uses ApplicationContext for centralized EF Core configuration
  • Separation of concerns with interfaces and dependency injection

🧪 Getting Started

1. Clone the repo

git clone https://github.com/markdicks/Test_API.git
cd Test_API

2. Setup your local database connection

Copy appsettings.json to a local override version:

cp appsettings.json appsettings.Development.json

Then edit appsettings.Development.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=.;Database=TestDb;Trusted_Connection=True;TrustServerCertificate=True;"
  }
}

🔐 Never commit appsettings.Development.json – it contains sensitive info.


🛠️ EF Core Migrations

Migrations are kept under version control for shared schema management.

To add a new migration (using Package Manager Console):

Add-Migration <name_of_migration>

To apply migrations:

Update-Database

🧪 Run the API

cd OA.Web
dotnet run

The API will start on:

https://localhost:5001

🧼 .gitignore Highlights

# Local secrets & sensitive configs
appsettings.Development.json

# Migrations (Comment out if you want to keep them)
OA.Repo/Migrations/*

🧠 Notes

  • Follows SOLID principles and clean architecture practices
  • Migrations use schema prefixing (Test_) for namespace isolation
  • DI setup via builder.Services.AddScoped and AddTransient based on service lifetimes
  • OA stands for "Onion Architecture"

📦 Packages

  • Microsoft.EntityFrameworkCore (9.0.4)
  • Microsoft.EntityFrameworkCore.SqlServer
  • Microsoft.EntityFrameworkCore.Tools

📌 License

MIT © Mark Dicks

Status

Alt

About

Test project intended to create API for data-focused apps in the future. Class libraries for API, Blazor for UI and testing

Resources

Stars

Watchers

Forks