XoomCore is a web application developed using Entity Framework Core Code First Approach. It follows the principles of a layered architecture, specifically the Onion Architecture pattern.
The XoomCore project utilizes the following technologies and frameworks:
- .NET 6
- Entity Framework Core
- Microsoft SQL Server
The XoomCore project is structured as follows within the solution:
- XoomCore.Core
- XoomCore.Infrastructure
- XoomCore.Application
- XoomCore.Services
- XoomCore.Web
The project follows the Onion Architecture pattern, which promotes a clear separation of concerns and adheres to the dependency inversion principle. It consists of the following layers:
- Core Layer: Contains core data entities for repositories.
- Infrastructure Layer: Handles data access, including the database context and advanced features like caching and logging.
- Application Layer: Focuses on application-specific business logic, services, and ViewModels for the user interface.
- Services Layer: Contains middleware, session management, and mapping services.
- Web Layer: Serves as the entry point, managing HTTP requests and responses through controllers.
-
XoomCore.Core/: Contains core domain entities, enumerations, shared models, and startup configuration.Entities/: Core domain entity classes.Enum/: Enumerations for various entity properties.Shared/: Shared models for common data structures.Startup.cs: Configuration and setup for the core layer.
-
XoomCore.Infrastructure/: Handles infrastructure concerns, including caching, helpers, logging, database migrations, persistence, repositories, unit of work, and setup.Caching/: Implementations related to caching.Helpers/: Utility classes to assist with various tasks.Logging/: Logging infrastructure for tracking application behavior.Migrations/: Database migration scripts.Persistence/: Database context and settings.Repositories/: Data repositories for data access.UnitOfWorks/: Implementation of the unit of work pattern.Startup.cs: Configuration and setup for the infrastructure layer.
-
XoomCore.Application/: Manages view models for shaping data, request models for input validation, response models for API data, application-specific business logic, and configuration.ViewModels/: View model classes used to shape data for presentation.RequestModels/: Request models for input validation and data transfer.ResponseModels/: Response models representing data returned from the API.BusinessLogic/: Contains application-specific business logic.Startup.cs: Configuration and setup for the application layer.
-
XoomCore.Services/Concretes/: Implements service interfaces, service concretes, AutoMapper profiles, middleware, session management, and setup.Contracts/: Service interfaces defining the contract for service classes.Concretes/: Service implementations that fulfill the service contracts.Mapper/: Contains AutoMapper profiles for object mapping.Middleware/: Middleware components for application processing.SessionControl/: Session management services.Startup.cs: Configuration and setup for the services layer.
-
XoomCore.Web/: Manages access control, authentication, configurations, controllers for handling HTTP requests, and serves as the application's entry point.AccessControl/: Module handling access control logic, including controllers and views.Authentication/: Module responsible for authentication, including controllers and views.Configurations/: Configuration settings, including database configuration.Controllers/: Controllers for handling HTTP requests and serving views.Program.cs: Application entry point and setup.
Before you get started with the XoomCore project template, make sure you have the following prerequisites installed:
- .NET 6 SDK (or a later version)
- Microsoft SQL Server (or another compatible database)
- Visual Studio (or Visual Studio Code) with C# support
- Visit the Visual Studio Marketplace page for the XoomCoreWeb template.
- Click the "Download" button to obtain the template in the form of a VSIX file.
- Once the download is complete, locate the downloaded VSIX file on your computer.
- Double-click the downloaded VSIX file. This action will open Visual Studio and prompt you to install the template.
- Follow the installation wizard's instructions to complete the installation.
- It's advisable to restart Visual Studio after the installation to ensure that the template is loaded.
- Open your chosen development environment, such as Visual Studio or Visual Studio Code.
- Create a new project and select "XoomCoreWeb" from the list of available project templates.
- Follow the project creation wizard's instructions to set up your project.
- After the project is created, you can start customizing it to meet your specific requirements. This may involve tasks like configuring the database connection string, adding controllers, views, and more.
The XoomCore application relies on Entity Framework Core Code First Approach to interact with the database. To configure the database connection, follow these steps:
-
Open the
Configurations/database.jsonfile in your project. -
Locate the
"ConnectionString"setting and replace it with your own database connection string.Example:
"DatabaseSettings": { "DBProvider": "mssql", "ConnectionString": "Server=ServerName;Integrated Security=SSPI;Database=XoomCoreDb;Trusted_Connection=True;TrustServerCertificate=True;MultipleActiveResultSets=True;User Id=your_user_id;password=your_password" }
To create and update your database using Entity Framework migrations, follow these steps:
-
Open the Package Manager Console in Visual Studio via
View > Other Windows > Package Manager Console. -
Ensure that the
XoomCore.Infrastructureproject is selected in the Package Manager Console. If not, select it. -
Execute the following command to apply migrations and update the database:
update-database
You're all set! You now have a new project based on the XoomCore template, and you're ready to start building your application. Happy coding!
Admin:
{
"Email":"admin@gmail.com",
"Password":"Abcd1234."
}User:
{
"Email":"user@gmail.com",
"Password":"Abcd1234."
}Follow the C# coding standards and guidelines outlined by Microsoft to maintain consistent and readable code.
Adhere to the following naming conventions:
- Class names should be in PascalCase.
- Interface names should begin with "I" and use PascalCase.
- Method names should be in PascalCase.
- Property names should be in PascalCase.
Utilize Serilog for logging throughout the application to track important events and errors.
The XoomCore application provides a User Module for managing users, including action permissions.
The application uses the generic repository pattern to abstract data access and provide a consistent interface for data operations.
API responses follow a common response model (CommonResponse<T>) to provide a unified structure for success and error responses.
Request and response models are used to validate and transfer data between the client and server.
The application includes an EntityLogEntity to record data changes in the database. It is implemented in the SaveChangesAsync method of the ApplicationDbContext.
The XoomCore project is a .NET Core web application that follows best practices and the Onion Architecture pattern. It include the User Module, which enables comprehensive user management with action permissions, and the use of the generic repository pattern, ensuring efficient and consistent data access. The application adopts a common response model (CommonResponse) for API interactions and employs request and response models for secure data transfer. Additionally, an audit log mechanism tracks data changes in the database, further enhancing data integrity and accountability.
We'd also like to acknowledge the use of the Sneat Bootstrap HTML Admin Template for the project's UI design.
This project is licensed under the MIT License.
You can find us on social media:
Feel free to connect with us and stay updated on our projects and activities.