Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Entity constructor and update README #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Bookify

Bookify is a C# application designed to help manage and organize book collections efficiently using Clean Architecture principles. This modular and maintainable architecture ensures that the application is scalable, testable, and easy to understand.

## Clean Architecture Principles Applied in Bookify

* **Separation of concerns**: The code is organized into different layers, each with a specific responsibility. For example, the `src/Bookify.Domain` directory contains domain entities and value objects, while the `src/Bookify.Application` directory (not shown) likely contains application logic.
* **Dependency inversion**: High-level modules do not depend on low-level modules. Instead, both depend on abstractions. For example, the `IUnitOfWork` interface in `src/Bookify.Domain/Abstractions/IUnitOfWork.cs` abstracts the persistence mechanism.
* **Domain-centric design**: The core business logic is encapsulated in the domain layer. For example, the `Apartment` class in `src/Bookify.Domain/Apartments/Apartment.cs` and the `Booking` class in `src/Bookify.Domain/Bookings/Booking.cs` contain the business rules and logic.
* **Use of value objects**: Value objects are used to represent concepts in the domain. For example, `Address` in `src/Bookify.Domain/Apartments/ValueObjects/Address.cs` and `Money` in `src/Bookify.Domain/Shared/Money.cs` are value objects that encapsulate specific domain concepts.
* **Event-driven architecture**: Domain events are used to signal changes in the state of the system. For example, the `BookingReservedDomainEvent` in `src/Bookify.Domain/Bookings/Events/BookingReservedDomainEvent.cs` is raised when a booking is reserved.
* **Testability**: The architecture promotes testability by isolating the business logic from external dependencies. For example, the `PricingService` in `src/Bookify.Domain/Bookings/Services/PricingService.cs` can be tested independently of the rest of the system.
6 changes: 3 additions & 3 deletions src/Bookify.Domain/Abstractions/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

public abstract class Entity
{
private readonly List<IDomainEvent> _domainEvents = [];
private readonly List<IDomainEvent> _domainEvents = new List<IDomainEvent>();
public Guid Id { get; init; }

protected Entity(Guid id)
{
id = Id;
Id = id;
}

public IReadOnlyList<IDomainEvent> GetDomainEvents()
Expand All @@ -25,4 +25,4 @@ protected void RaiseDomainEvent(IDomainEvent domainEvent)
_domainEvents.Add(domainEvent);
}

}
}