Conversation
…eDtos New Features: - ExcludeMembersFromType: Exclude all members from specified types (base classes, interfaces) - InterfaceContracts: Generated DTOs implement specified interfaces using typeof() syntax - Enhanced EF Core UpdateFromFacet with advanced filtering options and FacetUpdateIgnoreAttribute Changes: - Updated GenerateDtosAttribute and GenerateAuditableDtosAttribute to use Type[] for better type safety - Added comprehensive parameter options for UpdateFromFacet methods (skipKeys, skipConcurrency, etc.) - Enhanced documentation with practical examples in README files - Added comprehensive test coverage for new features 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…el export validation - Remove suspicious early return that allowed test to pass without validation - Add proper assertion for context count > 0 to ensure DbContext instantiation - Create TestDbContextFactory to enable design-time DbContext creation - Add robust integration tests with detailed navigation property validation - Add Verify.Xunit snapshot testing support (NavigationPropertyVerifyTests) - Validate all 8 expected navigation properties across 5 entities: - Category → Products (collection) - Product → Category (single), OrderItems (collection) - User → Orders (collection) - Order → User (single), OrderItems (collection) - OrderItem → Order (single), Product (single) All tests now properly validate that EF navigation properties are correctly serialized to JSON by the MSBuild ExportEfModelTask. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Simplified DbContext extensions to avoid circular references - Added Compile Remove for Generated files to prevent compilation conflicts - Split DbContext extension generation from individual builder generation - DbContext extensions now return IQueryable instead of strongly-typed builders 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements "NavigationalProperty inclusion" functionality for the Facet library, adding two major features: ExcludeMembersFromType and InterfaceContracts for DTO generation, plus comprehensive EF Core integration and testing infrastructure.
Key changes:
- ExcludeMembersFromType: Allows excluding all members from specified base classes/interfaces during DTO generation
- InterfaceContracts: Enables generated DTOs to implement specified interfaces using
typeof()syntax - Enhanced EF Core Integration: Complete MSBuild task infrastructure for exporting EF model metadata to JSON with navigation property support
Reviewed Changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/Facet/GenerateDtosAttribute.cs |
Added ExcludeMembersFromType and InterfaceContracts properties with Type[] for type safety |
src/Facet/Generators/GenerateDtosGenerator.cs |
Enhanced generator to support new features with nullability handling and interface implementation |
src/Facet.Extensions.EFCore/Tasks/ExportEfModelTask.cs |
New MSBuild task for exporting EF model metadata including navigation properties to JSON |
src/Facet.Extensions.EFCore/FacetEfCoreExtensions.cs |
Enhanced UpdateFromFacet methods with advanced filtering, FacetUpdateIgnoreAttribute, and comprehensive parameter options |
test/Facet.TestConsole/GenerateDtosTests/TestModels.cs |
New test models demonstrating ExcludeMembersFromType and InterfaceContracts features |
test/Facet.Extensions.EFCore.Tests/ |
Comprehensive test suite with navigation property serialization validation, integration tests, and Verify snapshot testing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| "profiles": { | ||
| "Domain": { | ||
| "commandName": "DebugRoslynComponent", | ||
| "targetProject": "../../../../backend/Immybot.Backend.Domain/Immybot.Backend.Domain.csproj" |
| /// Source generator for EF Core fluent navigation builders. | ||
| /// </summary> | ||
| [Generator(LanguageNames.CSharp)] | ||
| public sealed class FacetEfGenerator : IIncrementalGenerator |
There was a problem hiding this comment.
I think.Extensions.EFCore has been incorrectly configured as a source generator and I also think it will be tricky to add this source generator here. I believe the project should target framework netstandard2 for this to work.
There was a problem hiding this comment.
Sure thing. I'll retarget it in the morning and see how far I can get.
- Create new Facet.UnitTests project with proper xUnit structure - Implement source generator tests using Verify.SourceGenerators for snapshot testing - Add Entity Framework integration tests with TestDbContextFixture - Include test entity models and DTOs for comprehensive test coverage - Support multiple test categories: basic generation, inheritance, modern records - Enable TreatWarningsAsErrors for code quality consistency - Provide proper test isolation with in-memory SQLite databases
…development - Update debugger agent for Facet-specific debugging patterns - Enhance debug command with build log analysis and generated code checks - Refine validate_plan command for source generator validation workflows - Add source_generator_specialist agent for domain expertise - Update local settings for improved development experience
…eneration - Implement ChainUseDiscovery for analyzing actual navigation chain usage patterns - Optimize FluentBuilderEmitter and SelectorsEmitter with usage-driven generation - Add ShapeInterfacesEmitter improvements for better type generation - Enhance diagnostic reporting with structured error messages - Improve FacetEfGenerator with incremental generation optimizations - Add extension methods for better developer experience in FacetEfCoreExtensions
- Extend GenerateDtosAttribute with improved configuration options - Enhance GenerateDtosTargetModel with better type resolution - Optimize GenerateDtosGenerator with incremental generation patterns - Add analyzer release tracking files for proper versioning - Improve attribute validation and error reporting
- Improve AsyncProjectionExtensionsTests with additional test scenarios - Enhance TestDbContext with better test data setup and configuration - Add FluentNavigationIntegrationTests for end-to-end validation - Include generated test files and TDD infrastructure - Add efmodel.json export validation for MSBuild integration testing - Establish comprehensive test patterns for source generator validation
- Add analyzer release tracking for TestConsole project - Include development scripts for automation and tooling - Add comprehensive specifications for enhanced DTO generation features - Add progress tracking documentation for development milestones - Establish documentation structure for ongoing feature development
- Add git commit command to approved list for automation - Maintain secure development environment with controlled command access
- Update centralized version in Directory.Build.props - Prepare for release with enhanced DTO generation and EF Core features
…text - Update create_feature.md with Facet-specific patterns and terminology - Enhance create_implementation_strategy.md for source generator workflows - Refactor write_tests.md with comprehensive Facet testing patterns and Entity Framework integration - Replace MCPlatform references with Facet source generator context - Add specific guidance for testing generated code and EF integration
- Remove settings.local.json and launchsettings.json files - Add these file patterns to .gitignore to prevent future commits - These files contain local development settings that should not be tracked 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix null reference warnings in FacetGenerator.cs by adding null-forgiving operators - Add diagnostic rules to AnalyzerReleases.Unshipped.md files to resolve RS2000 warnings - Build now completes with 0 warnings and 0 errors 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update Verify.Xunit to v26.5.0 to fix TypeLoadException with Guard type - Add explicit Verify package reference for proper dependency resolution - Fix FacetEfGenerator to discover GenerateAuditableDtos attributes - Enhanced source generator diagnostics for better debugging - Improve test metadata references to properly include Facet assembly - Add defensive null checks in generator constructors - Enable debug output in EF Core test project - Add Microsoft.CodeAnalysis packages to EF Core tests project - Update generated selector files with enhanced projection support These changes restore full test suite functionality and improve the robustness of the source generation pipeline. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
- Use IReadOnlyModel/IReadOnlyEntityType interface methods to enumerate model metadata (avoids extension reflection and ALC type identity issues) - Add provider hint property; prefer design-time factory; robust InMemory/Npgsql fallback - Improve assembly probing (task assembly dir) and logging at Normal importance
…/Npgsql context creation
- Remove all tracked files in bin/ and obj/ directories - Remove IDE-specific files (.DS_Store, .idea/, *.user files) - These files are already covered by .gitignore patterns but were previously tracked - Future builds will properly respect gitignore rules
- Add ILRepack.Lib.MSBuild.Task for cross-platform assembly merging - Add assembly resolver to FacetEfGenerator as backup solution - Fix nullable property initialization in generated shape classes - Resolves GitHub Issue #79272: Allow Analyzer ProjectReference Dependencies to Be Loaded Automatically This enables .WithProviderLink() source generation to work properly by merging all analyzer dependencies into a single self-contained DLL.
| <PropertyGroup> | ||
| <!-- Centralized version for all Facet packages --> | ||
| <Version>2.5.0</Version> | ||
| <Version>2.6.0</Version> |
There was a problem hiding this comment.
This version, is automatically updated by de release workflow. From the pipeline, it extracts the tag version number and commits it to the main branch :)
There was a problem hiding this comment.
Awesome. Good to know. I'm still very much hammering this out but I got over the part I was stuck on which was that ProjectReferences don't work exactly right in SourceGenerators which is why I brought in IL Merge
|
I believe the current way of including navigational properties with EF and NestedFacets setup, we got a pretty good solution. This branch has been stale for a while and for those reasons, I'll close the PR now. Thanks for your time anyway! |
Add ExcludeMembersFromType and InterfaceContracts features to GenerateDtos
New Features:
Changes:
🤖 Generated with Claude Code