This guide helps you migrate from Facet 5.0.0-alpha releases to the stable 5.0.0 GA release.
- Removed obsolete
GenerateBackToproperty - UseGenerateToSourceinstead - GenerateToSource - Defaults to false. Set to true if you need the reverse mapper!
- [MapWhen] - Conditional property mapping
- [MapFrom] - Declarative property renaming
- [FlattenTo] - Collection unpacking
- SmartLeaf flattening strategy
- Source signature tracking with FAC022 analyzer
- Automatic EF Core navigation loading
- Advanced async mapping with DI support
- Expression transformation utilities
- 17 comprehensive Roslyn analyzers
- Code fix providers for common issues
Update all Facet packages to version 5.0.0:
<PackageReference Include="Facet" Version="5.0.0" />
<PackageReference Include="Facet.Extensions" Version="5.0.0" />
<PackageReference Include="Facet.Extensions.EFCore" Version="5.0.0" />
<PackageReference Include="Facet.Extensions.EFCore.Mapping" Version="5.0.0" />
<PackageReference Include="Facet.Mapping" Version="5.0.0" />
<PackageReference Include="Facet.Mapping.Expressions" Version="5.0.0" />Or via CLI:
dotnet add package Facet --version 5.0.0
dotnet add package Facet.Extensions --version 5.0.0
dotnet add package Facet.Extensions.EFCore --version 5.0.0Search for: GenerateBackTo
Replace with: GenerateToSource
Before (Alpha):
[Facet(typeof(User), GenerateBackTo = true)]
public partial class UserDto;
[Facet(typeof(Product), "InternalNotes", GenerateBackTo = false)]
public partial class ProductDto;After (GA):
[Facet(typeof(User), GenerateToSource = true)]
public partial class UserDto;
[Facet(typeof(Product), "InternalNotes", GenerateToSource = false)]
public partial class ProductDto;Visual Studio:
- Press
Ctrl+Shift+H(Find and Replace in Files) - Find:
GenerateBackTo - Replace:
GenerateToSource - Click "Replace All"
Rider:
- Press
Ctrl+Shift+R(Replace in Path) - Find:
GenerateBackTo - Replace:
GenerateToSource - Click "Replace All"
VS Code:
- Press
Ctrl+Shift+H(Replace in Files) - Find:
GenerateBackTo - Replace:
GenerateToSource - Click "Replace All"
Command Line (PowerShell):
Get-ChildItem -Recurse -Include *.cs |
ForEach-Object {
(Get-Content $_.FullName) -replace 'GenerateBackTo', 'GenerateToSource' |
Set-Content $_.FullName
}Command Line (Bash):
find . -name "*.cs" -type f -exec sed -i 's/GenerateBackTo/GenerateToSource/g' {} +dotnet clean
dotnet buildThis ensures all generated code is regenerated with the new version.
dotnet testEnsure all tests pass after the migration.
- All Facet packages updated to 5.0.0
- All occurrences of
GenerateBackToreplaced withGenerateToSource - Solution builds without errors
- All tests pass
- No compiler warnings from Facet analyzers
- Generated code looks correct
After migrating, you can take advantage of new V5 features:
[Facet(typeof(Order))]
public partial class OrderDto
{
[MapWhen("Status == OrderStatus.Completed")]
public DateTime? CompletedAt { get; set; }
}[Facet(typeof(User), GenerateToSource = true)]
public partial class UserDto
{
[MapFrom(nameof(User.FirstName), Reversible = true)]
public string Name { get; set; }
}[Facet(typeof(Data), FlattenTo = [typeof(DataFlattened)])]
public partial class DataDto;[Facet(typeof(User), SourceSignature = "a1b2c3d4")]
public partial class UserDto;[Flatten(typeof(Person),
NamingStrategy = FlattenNamingStrategy.SmartLeaf,
IgnoreNestedIds = true)]
public partial class PersonFlat { }| Alpha API | GA API | Status | Notes |
|---|---|---|---|
GenerateBackTo |
GenerateToSource |
❌ Removed | Breaking change |
| All other attributes | Unchanged | ✅ Stable | No changes needed |
| All extension methods | Unchanged | ✅ Stable | No changes needed |
| All analyzers | Enhanced | ✅ Compatible | Better messages |
Once you've completed these steps, you're successfully migrated to Facet 5.0.0 GA!
Enjoy the new features and improved stability.
We'd love to hear about your migration experience:
- Was this guide helpful?
- Did you encounter any issues?
- What could be improved?
Please share feedback at: https://github.com/Tim-Maes/Facet/issues
Happy coding with Facet 5.0.0!