Skip to content

Comments

Feature/initial#1

Merged
kr0ggg merged 13 commits intomainfrom
feature/initial
Jan 14, 2026
Merged

Feature/initial#1
kr0ggg merged 13 commits intomainfrom
feature/initial

Conversation

@kr0ggg
Copy link
Collaborator

@kr0ggg kr0ggg commented Jan 14, 2026

No description provided.

Greg Cook added 13 commits January 14, 2026 11:20
- Add ReadOnlyDbSetExtensions with CreateAsync methods for test data creation
- Add DbSetExtensions with AsReadOnly method for ReadOnlyDbSet conversion
- Implement comprehensive unit test suite with 9 passing tests
- Add TestDbContext with proper ReadOnlyDbSet setup
- Remove cross-repository dependencies for standalone testing
- Fix extension method syntax and reflection-based inner DbSet access
- Add production safety warnings and environment validation

Tests: 9 passed, 0 failed
- Add missing Release configuration for test project in solution file
- Fix broken extension method syntax in ReadOnlyDbSetExtensions.cs
- Convert malformed nested extension structure to proper extension methods
- Removed explicit 'using System;' since ImplicitUsings is enabled
- Clean and rebuild to resolve duplicate assembly attribute errors
- All tests still pass in Release configuration
- Modified project file to use project references when CI=true is set
- This ensures GitHub Actions can find Bounteous.Data and Bounteous.Core types
- Package references still used for local Release builds (CI != true)
- Verified build and tests pass with CI=true environment variable
- Added back Bounteous.Data and Bounteous.Core project references to Debug config
- ReadOnlyDbSetExtensions.cs requires these types in both Debug and Release
- Both configurations now build successfully
- All tests pass in Release configuration
…gurations

- Removed local project references, now using NuGet packages for both Debug and Release
- Both configurations use Bounteous.Data v0.0.26 and Bounteous.Core v0.0.18
- Ensures consistent dependency management across all environments
- All builds and tests pass successfully
- Added ProductionUsageAttribute for marking production-restricted APIs
- Created ProductionDetector utility with smart context detection:
  * Allows usage in Debug builds
  * Allows usage in data migration contexts (even Release)
  * Allows usage in test contexts (xUnit, NUnit, MSTest)
  * Blocks usage in production Release builds
- Enhanced ProductionWarningMarker with ValidateContext() method
- Updated ReadOnlyDbSetExtensions to use new production detection
- Added ProductionDetectorTests to verify functionality
- All 7 tests pass including new production detection tests
- Added 'using System;' to ProductionWarningMarker.cs
- Added explicit imports to ReadOnlyDbSetExtensions.cs:
  * System
  * System.Collections.Generic  
  * System.Reflection
  * System.Threading.Tasks
- Clean and rebuild resolved duplicate assembly attribute issues
- All 7 tests pass and lint errors are resolved
## Multi-Strategy Detection System:
- **Strategy 1**: Explicit production environment variables (ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, etc.)
- **Strategy 2**: Production hosting environments (Azure, AWS, GCP, Kubernetes, Heroku, Vercel, etc.)
- **Strategy 3**: Production assembly pattern detection (.web, .api, .service, etc.)
- **Strategy 4**: Development environment detection (Development, Local, Dev)

## Enhanced Capabilities:
- **Performance**: Lazy caching for production/allowed context detection
- **Comprehensive Test Detection**: xUnit, NUnit, MSTest, Moq, NSubstitute, etc.
- **Enhanced Migration Detection**: EF tools, command line args, call stack analysis
- **Detailed Error Messages**: Shows detection state in exceptions
- **Cloud Hosting Support**: Detects Azure Functions, AWS Lambda, Google Cloud, etc.

## Key Improvements:
- Fixed circular dependency in detection logic
- Added nullable reference handling
- Comprehensive test coverage (23 tests pass)
- Backward compatibility maintained

## Detection Examples:
✅ **Allowed**: Debug builds, EF migrations, xUnit/NUnit tests, Development env
❌ **Blocked**: Release builds in production hosting, production assemblies, Production env

All tests pass in Release configuration while maintaining production safety.
- Re-enabled <ImplicitUsings>enable</ImplicitUsings> in project file
- Disabling implicit usings caused IDE linting to not recognize System types
- Build and tests continue to work correctly with implicit usings enabled
- All 23 tests pass in Release configuration
- Clean and rebuild resolved duplicate assembly attribute issues
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@kr0ggg kr0ggg merged commit 0f445da into main Jan 14, 2026
2 checks passed
@kr0ggg kr0ggg deleted the feature/initial branch January 14, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant