A comprehensive .NET 8 C# console application for managing a book collection with full CRUD operations. Features a BIOS-style two-pane console interface, clean architecture, and SQLite database.
- Full CRUD Operations: Create, Read, Update, and Delete books
- Clean Architecture: Organized with Interfaces/Services pattern
- Dependency Injection: Using Microsoft.Extensions.DependencyInjection
- SQLite Database: Lightweight, file-based database with Entity Framework Core
- BIOS-Style UI: Two-pane console interface with box-drawing characters
- Input Validation: Ensures data integrity with required field validation
- Search Functionality: Find books by title or ISBN
- ISBN Uniqueness: Enforced at database level
BookManagementSystem/
├── Models/ # Entity classes
│ └── Book.cs
├── Data/ # DbContext and database configuration
│ └── BookDbContext.cs
├── Interfaces/ # Service contracts
│ └── IBookService.cs
├── Services/ # Service implementations
│ └── BookService.cs
├── UI/ # Console rendering logic
│ ├── ConsoleUI.cs
│ └── BookManager.cs
├── Program.cs # Application entry point with DI setup
└── BookManagementSystem.csproj
- .NET 8 SDK or later
- A terminal/command prompt that supports Unicode characters
Navigate to the project directory:
cd BookManagementSystemdotnet restoredotnet buildThe application uses Entity Framework Core with SQLite. The database will be created automatically on first run. However, if you want to use migrations:
dotnet ef migrations add InitialCreatedotnet ef database updateNote: The application uses EnsureCreatedAsync() which automatically creates the database on first run, so manual migration is optional.
dotnet runThe application will launch with a BIOS-style two-pane interface.
- ↑/↓ Arrow Keys: Navigate through menu items
- Enter: Select/Confirm
- ESC: Exit or Cancel current operation
Adds a new book to the database.
Required Fields:
- Title
- Author Name
- ISBN (must be unique)
Optional Fields:
- Edition
- Publisher Name
- URL
Steps:
- Select "Add Book" from the main menu
- Enter the book details when prompted
- Press Enter after each field
- The book will be saved and you'll see a confirmation message
Displays all books in the database in a tabular format.
Columns Displayed:
- Book ID
- Title
- Author
- ISBN
Features:
- Pagination support for large datasets
- Shows total count of books
- Truncates long text to fit the display
Search for books by title or ISBN.
Steps:
- Select "Search Books" from the main menu
- Enter your search term (title or ISBN)
- Matching results will be displayed in a table
- Shows count of matching books
Search Behavior:
- Case-insensitive search
- Partial matching supported
- Searches both Title and ISBN fields
Update an existing book's information.
Steps:
- Select "Edit Book" from the main menu
- Enter the Book ID or ISBN of the book to edit
- Current book details will be displayed
- Enter new values or press Enter to keep existing values
- Confirmation message will be shown
Notes:
- ISBN uniqueness is validated during edit
- All fields can be updated except Book ID
Remove a book from the database.
Steps:
- Select "Delete Book" from the main menu
- Enter the Book ID or ISBN of the book to delete
- Book details will be displayed
- Confirm deletion by pressing 'Y' or cancel with 'N'
- Confirmation message will be shown
Warning: Deletion is permanent and cannot be undone.
Closes the application.
| Property | Type | Required | Unique | Description |
|---|---|---|---|---|
| BookId | int | Auto-generated | Yes | Primary key |
| Title | string | Yes | No | Book title (max 200 chars) |
| Edition | string | No | No | Book edition (max 50 chars) |
| AuthorName | string | Yes | No | Author name (max 150 chars) |
| PublisherName | string | No | No | Publisher name (max 150 chars) |
| ISBN | string | Yes | Yes | ISBN (max 20 chars) |
| URL | string | No | No | Related URL (max 500 chars) |
The application follows clean architecture principles:
- Separation of Concerns: UI, Business Logic, and Data Access are separated
- Dependency Injection: Services are registered and injected via DI container
- Interface-Based Design: Business logic uses interfaces for loose coupling
- Async/Await: All database operations are asynchronous
- Provider: SQLite
- ORM: Entity Framework Core 8.0
- Connection String:
Data Source=books.db(stored in current directory) - Constraints: Unique index on ISBN field
- Microsoft.EntityFrameworkCore (8.0.0)
- Microsoft.EntityFrameworkCore.Sqlite (8.0.0)
- Microsoft.EntityFrameworkCore.Design (8.0.0)
- Microsoft.Extensions.DependencyInjection (8.0.0)
The connection string can be modified in Program.cs:
var connectionString = "Data Source=books.db";To use a different location:
var connectionString = "Data Source=C:\\path\\to\\your\\books.db";The UI is optimized for 170x48 character display (1366x768 screen resolution). You can adjust this in ConsoleUI.cs:
private const int WindowWidth = 170;
private const int WindowHeight = 48;
private const int LeftPaneWidth = 120;If the box-drawing characters don't display correctly:
- Ensure your terminal supports UTF-8 encoding
- On Windows, use Windows Terminal or PowerShell 7+
- On older Windows systems, you may need to change console font to a Unicode-compatible font
If you encounter database errors:
- Delete the
books.dbfile - Run the application again to create a fresh database
If you get build errors:
- Ensure .NET 8 SDK is installed:
dotnet --version - Clean the solution:
dotnet clean - Restore packages:
dotnet restore - Build again:
dotnet build
Potential features for future versions:
- Export books to CSV/JSON
- Import books from file
- Advanced filtering and sorting
- Multi-author support
- Category/Genre classification
- Book cover image support
- Reading status tracking
This project is provided as-is for educational and personal use.
Book Management System v1.0. Created: Nov 30, 2025. Anaya Upadhyay
If you encounter any issues or have questions, please feel free to reach out via email: Anaya Upadhyay.
For additional guidance, refer to the source code comments, which include XML documentation for all public methods.