A .NET Core Worker Service designed to manage employee attendance, analyze attendance data, generate reports, and send email notifications.
- Verifies employee attendance from a SQL Server database.
- Generates reports for:
- Absent employees
- Employees with incomplete attendance
- Employees who arrived late
- Sends reports to administrators via email.
- Implements a structured, maintainable layered architecture.
- .NET Core 8 Worker Service
- Entity Framework Core 8 for database operations
- SQL Server as the database
- Dependency Injection for service management
- Elasticsearch for logging
- User Secrets for managing sensitive data
- SMTP for sending email notifications
Ensure the following tools are installed:
- .NET SDK
- SQL Server
- Elasticsearch (if logging is enabled)
Sensitive information, such as passwords and connection strings, must be stored securely using User Secrets.
dotnet user-secrets set "ConnectionStrings:DefaultConnection" "YourConnectionString"
dotnet user-secrets set "EmailSettings:Password" "YourEmailPassword"
dotnet user-secrets list
Run the migrations to set up the database schema and seed data: dotnet ef database update
To start the worker service, use: dotnet run
AttendanceWorkerService/ ├── src/ │ ├── Core/ │ │ ├── Entities/ # Entity classes (Employee, AttendanceRecord, etc.) │ │ ├── Enums/ # Enums for AttendanceStatus │ │ ├── Interfaces/ # Interface definitions (IUnitOfWork, IEmailService, etc.) │ ├── Infrastructure/ │ │ ├── Data/ # DbContext and repository implementations │ │ ├── Repositories/ # Repository classes (e.g., AttendanceRepository) │ ├── Worker/ # Background worker logic ├── appsettings.json # Non-sensitive configuration values ├── Program.cs # Entry point of the application
- Add a new migration: dotnet ef migrations add
- Update the database: dotnet ef database update
- Initialize User Secrets: dotnet user-secrets init
- Add or update a secret: dotnet user-secrets set "" ""
- List all secrets: dotnet user-secrets list
- Do not store sensitive information in
appsettings.json. - Use User Secrets for development and environment variables or secure secrets management tools (e.g., Azure Key Vault) for production.
- Fork the repository.
- Create a feature branch: git checkout -b feature/
- Commit changes and push to the branch.
- Submit a pull request.
This project is a PoC work from ClickMinds Solutions LLP.