Skip to content

wajid7511/GraphQlDemoPostgreSQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQlDemoPostgreSQL

This project demonstrates how to build GraphQL endpoints using .NET Core with PostgreSQL as the database. It is organized into several class libraries, each serving a distinct purpose within the application architecture. Below is an overview of each folder and its corresponding class library:

Folder Structure and Class Libraries

  1. Abstractions/GraphQlDemoPostgresQl.Abstractions

This class library defines the core interfaces and contracts used throughout the application. By centralizing these abstractions, the project promotes loose coupling and enhances testability.

🔹 Key Components:

Interfaces: Define contracts for services, repositories, and other components.

DTOs (Data Transfer Objects): Represent data structures for communication between different layers.

  1. ApiModels/GraphQlDemoPostgresQl.ApiModels

This library contains models that represent the data structures exposed by the GraphQL API. These models are tailored for client interactions and may differ from the internal database models.

🔹 Key Components:

GraphQL Types: Define the GraphQL object types, queries, mutations, and subscriptions.

Input Models: Represent the structure of inputs for GraphQL mutations.

  1. Common/GraphQlDemoPostgresQl.Common

This library provides common utilities, helpers, and constants used across the application. It ensures consistency and reduces redundancy. This also have a class which is created for RabbitMq.

🔹 Key Components:

Extensions: Methods that extend existing classes with additional functionality.

Constants: Define application-wide constant values.

Helpers: Utility classes and methods for common tasks (e.g., logging, error handling).

  1. Core/GraphQlDemoPostgresQl.Core

This library encapsulates the business logic of the application. It implements the interfaces defined in the Abstractions project and contains the core functionalities.

🔹 Key Components:

Services: Implement business operations and coordinate between repositories and API models.

Managers: Handle complex business rules and workflows.

  1. Database/GraphQlDemoPostgresQl.Database

This library is responsible for database interactions, including the Entity Framework Core (EF Core) DbContext and migrations.

🔹 Key Components:

DbContext: Manages the database connection and is responsible for querying and saving data.

Migrations: Handle schema changes and versioning of the database.

  1. DatabaseModels/GraphQlDemoPostgresQl.DatabaseModels

This library contains the entity models that map directly to the database tables. These models are used by the DbContext to perform CRUD operations.

🔹 Key Components:

Entities: Classes that represent the database tables and their relationships.

Configurations: Fluent API configurations for entity properties and relationships.

  1. This library contains a console application that consumes messages from RabbitMQ. It is designed to run parallel with GraphQlDemoPostgresQl.

🔹 Key Components: RabbitMQ Consumer – Listens for messages from the queue and processes them.

  1. GraphQlDemoPostgresQl (Main Application)

This is the main entry point of the application. It sets up the ASP.NET Core host, configures services, and defines the middleware pipeline.

🔹 Key Components:

Startup.cs: Configures services and the application's request pipeline.

Program.cs: Contains the Main method, which is the entry point of the application.

Configuration Files: e.g., appsettings.json for application configuration settings.

By organizing the project into these distinct class libraries, the application achieves a modular structure that promotes maintainability, scalability, and clear separation of concerns.

About

A demo project for building GraphQL endpoints with .NET Core, using PostgreSQL as the database for efficient data storage and retrieval. 🚀

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages