Skip to content
Merged
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
71 changes: 71 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# SilverCodeAPI - Copilot Instructions

## Project Overview
This is a .NET 9 API solution providing common infrastructure for data access patterns, including repository pattern and unit of work implementations.

## Technology Stack
- **Target Framework**: .NET 9
- **Language**: C#
- **Architecture**: Repository pattern with data services
- **Key Components**:
- Core.Common: Base implementations for repositories and data services
- Core.Common.Contracts: Interfaces and contracts
- Core.Common.DataModels: Data models and entities

## Coding Standards

### General Guidelines
- Follow C# naming conventions (PascalCase for public members, camelCase for private fields)
- Use nullable reference types appropriately
- Prefer async/await for I/O operations
- Keep methods focused and single-purpose

### Architecture Patterns
- **Repository Pattern**: Use generic repository base classes (BaseRepository, BaseRepositoryWithIntId, BaseRepositoryWithGuidId, BaseRepositoryWithStringId)
- **Data Service Pattern**: Implement data services using BaseDataService and its variants
- **Unit of Work**: Use IUnitOfWork for transaction management
- **Database Factory**: Use IDatabaseFactory for database context creation

### Code Organization
- Interfaces go in Core.Common.Contracts
- Base implementations go in Core.Common
- Use generic type constraints for ID types (int, Guid, string)
- Separate read operations (IReadRepository) from write operations (IRepository)

### Dependency Injection
- Design all services and repositories for dependency injection
- Use constructor injection
- Register services with appropriate lifetimes

### Error Handling
- Use appropriate exception types
- Include meaningful error messages
- Consider adding try-catch blocks for external dependencies

### Testing
- Write unit tests for business logic
- Consider integration tests for repository implementations
- Mock dependencies appropriately

### Documentation
- Add XML documentation comments for public APIs
- Document complex logic with inline comments
- Keep README files updated

## Project-Specific Rules
- When creating new repositories, inherit from appropriate base classes
- When creating new data services, inherit from BaseDataService variants
- Maintain consistency with existing ID type patterns (int, Guid, string)
- Follow the established separation between contracts and implementations
- Use IAuditor for audit logging when applicable

## File Naming
- Interface files: I{Name}.cs (e.g., IRepository.cs)
- Base class files: Base{Name}.cs (e.g., BaseRepository.cs)
- Keep file names consistent with the class names they contain

## Common Tasks
- **Adding a new repository**: Inherit from BaseRepository or its typed variants, implement required interfaces
- **Adding a new data service**: Inherit from BaseDataService or its typed variants
- **Adding new contracts**: Place interfaces in Core.Common.Contracts project
- **Extending functionality**: Consider adding to base classes when logic is reusable across multiple implementations
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Issue ID,Description,State,Severity,Story Points,Project Path,Location Kind,Path,Line,Column,Incident ID,Help Link,Assembly Name,Assembly Version,Assembly Public Key,Snippet
NuGet.0002,NuGet package upgrade is recommended,Active,Potential,1,Core.Common.Contracts\Core.Common.Contracts.csproj,File,Core.Common.Contracts\Core.Common.Contracts.csproj,,,Microsoft.EntityFrameworkCore 9.0.1,,,,,"Microsoft.EntityFrameworkCore, 9.0.1 Recommendation: Remove Microsoft.EntityFrameworkCore, and replace with new package Microsoft.EntityFrameworkCore 10.0.5"
Project.0002,Project's target framework(s) needs to be changed,Active,Mandatory,1,Core.Common.Contracts\Core.Common.Contracts.csproj,File,Core.Common.Contracts\Core.Common.Contracts.csproj,,,,,,,,Current target framework: net9.0 Recommended target framework: net10.0
NuGet.0002,NuGet package upgrade is recommended,Active,Potential,1,Core.Common\Core.Common.csproj,File,Core.Common\Core.Common.csproj,,,Microsoft.EntityFrameworkCore 9.0.1,,,,,"Microsoft.EntityFrameworkCore, 9.0.1 Recommendation: Remove Microsoft.EntityFrameworkCore, and replace with new package Microsoft.EntityFrameworkCore 10.0.5"
NuGet.0002,NuGet package upgrade is recommended,Active,Potential,1,Core.Common\Core.Common.csproj,File,Core.Common\Core.Common.csproj,,,Newtonsoft.Json 13.0.3,,,,,"Newtonsoft.Json, 13.0.3 Recommendation: Remove Newtonsoft.Json, and replace with new package Newtonsoft.Json 13.0.4"
NuGet.0004,NuGet package contains security vulnerability,Active,Optional,1,Core.Common\Core.Common.csproj,File,Core.Common\Core.Common.csproj,,,Microsoft.AspNetCore.Identity 2.3.0,,,,,"Microsoft.AspNetCore.Identity, 2.3.0 Recommendation: Microsoft.AspNetCore.Identity, 2.3.9"
Project.0002,Project's target framework(s) needs to be changed,Active,Mandatory,1,Core.Common\Core.Common.csproj,File,Core.Common\Core.Common.csproj,,,,,,,,Current target framework: net9.0 Recommended target framework: net10.0
NuGet.0002,NuGet package upgrade is recommended,Active,Potential,1,Core.Common.DataModels\Core.Common.DataModels.csproj,File,Core.Common.DataModels\Core.Common.DataModels.csproj,,,Microsoft.AspNetCore.Identity.EntityFrameworkCore 9.0.1,,,,,"Microsoft.AspNetCore.Identity.EntityFrameworkCore, 9.0.1 Recommendation: Remove Microsoft.AspNetCore.Identity.EntityFrameworkCore, and replace with new package Microsoft.AspNetCore.Identity.EntityFrameworkCore 10.0.5"
Project.0002,Project's target framework(s) needs to be changed,Active,Mandatory,1,Core.Common.DataModels\Core.Common.DataModels.csproj,File,Core.Common.DataModels\Core.Common.DataModels.csproj,,,,,,,,Current target framework: net9.0 Recommended target framework: net10.0
Loading
Loading