AddressBook is an ASP.NET Core Web API which provides a public address book (contacts) functionality.
- contacts need to contain name, date of birth, address and multiple telephone numbers
- contacts need to be unique by name and address
- creating, updating and deleting contacts
- providing access to single and multiple contacts (with pagination)
- provide a way of receiveing live updates for connected clients using SignalR
- Visual Studio 2019
- .NET Core 3.0.1 SDK
- PostgreSQL
- .NET Core 3.0
- Entity Framework Core 3.1.0
- Npgsql 3.1.0
- Automapper
The architecture patterns used for this application are based on DDD (Domain-Driven Design) approach.
- POCO entity classes
- DTOs
- Repository interfaces
- Services
- Data persistance infrastructure: repository implementations
- ORM: Entity Framework Core
- ASP.NET Core Web API
- Application contracts and implementation
- MVC filters
- API Models
- Hubs
- Open solution in Visual Studio
- Open the appsettings.json file from AddressBook.Api
- Add the connectionstring for PostgreSQL connection string
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Username=postgres;Password=password;Database=AddressBookDB;"
}
}
- In the the Package Manager console:
- Select Default Project: AddressBook.Infrastructure
- Run
update-database
NotificationHub is responsible for handling messages from clients and broadcasting them to all connected clients.
The BroadcastMessage
method can be called by a connected client to send a message to all clients.