├── assets ├── Facet.png └── FacetLogo.png ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ ├── build.yml │ ├── sync-docs-to-wiki.yml │ └── test.yml ├── src ├── Facet │ ├── AnalyzerReleases.Unshipped.md │ ├── SymbolNameExtensions.cs │ ├── AnalyzerReleases.Shipped.md │ ├── Generators │ │ ├── WrapperGenerators │ │ │ ├── WrapperGenerator.cs │ │ │ └── WrapperConstructorGenerator.cs │ │ ├── FlattenGenerators │ │ │ ├── FlattenGenerator.cs │ │ │ └── FlattenModels.cs │ │ ├── FacetGenerators │ │ │ ├── FacetGenerator.cs │ │ │ ├── MemberGenerator.cs │ │ │ ├── NullabilityAnalyzer.cs │ │ │ └── ToSourceGenerator.cs │ │ └── Shared │ │ │ └── FacetConstants.cs │ ├── Facet.csproj │ ├── GenerateDtosTargetModel.cs │ ├── Analyzers │ │ └── SourceSignatureCodeFixProvider.cs │ └── WrapperTarget.cs ├── Facet.Dashboard │ ├── Templates │ │ ├── member-row.html │ │ ├── members-table.html │ │ ├── empty-state.html │ │ ├── facet-card.html │ │ └── source-card.html │ ├── Facet.Dashboard.csproj │ ├── FacetDashboardOptions.cs │ ├── TemplateEngine.cs │ └── FacetMemberInfo.cs ├── Facet.Attributes │ ├── Facet.Attributes.csproj │ ├── README.md │ ├── Optional.cs │ ├── WrapperAttribute.cs │ ├── MapWhenAttribute.cs │ └── MapFromAttribute.cs ├── Facet.Mapping │ ├── Facet.Mapping.csproj │ ├── IFacetMapConfiguration.cs │ ├── IFacetMapConfigurationAsync.cs │ ├── IFacetMapConfigurationWithReturn.cs │ └── IFacetMapConfigurationHybrid.cs ├── Facet.Extensions │ ├── Facet.Extensions.csproj │ ├── FacetCache.cs │ └── FacetSourceCache.cs ├── Facet.Extensions.EFCore │ └── Facet.Extensions.EFCore.csproj ├── Facet.Mapping.Expressions │ ├── Facet.Mapping.Expressions.csproj │ └── ParameterReplacer.cs └── Facet.Extensions.EFCore.Mapping │ └── Facet.Extensions.EFCore.Mapping.csproj ├── test ├── Facet.Tests │ ├── UnitTests │ │ ├── Core │ │ │ ├── GenerateDtos │ │ │ │ ├── GenerateDtosErrorHandlingTests.cs │ │ │ │ └── GenerateDtosSimpleTest.cs │ │ │ └── Facet │ │ │ │ ├── StaticClassNestedTypeTests.cs │ │ │ │ ├── AccessibilityTests.cs │ │ │ │ ├── BasicMappingTests.cs │ │ │ │ ├── NullableCollectionNestedFacetsTests.cs │ │ │ │ ├── NullableForeignKeyTests.cs │ │ │ │ ├── InheritedMemberTests.cs │ │ │ │ └── ProjectionStructureTests.cs │ │ ├── BasicMappingCollectionTests.cs │ │ ├── Features │ │ │ ├── BackToRequiredFieldsTests.cs │ │ │ ├── ToSourceRequiredFieldsTests.cs │ │ │ └── NullableHandlingTests.cs │ │ └── Wrapper │ │ │ ├── NestedWrapperTests.cs │ │ │ ├── BasicWrapperTests.cs │ │ │ └── ReadOnlyWrapperTests.cs │ ├── GlobalUsings.cs │ ├── TestModels │ │ ├── StaticClassTestModels.cs │ │ ├── GlobalNamespaceTestEntities.cs │ │ ├── CircularReferenceTestModels.cs │ │ └── TestEntities.cs │ └── Facet.Tests.csproj ├── setup.md ├── run-tests.sh └── run-tests.bat ├── NuGet.Config ├── LICENSE.txt ├── docs ├── 01_Facetting.md ├── 02_QuickStart.md ├── README.md ├── 16_SourceSignature.md └── 12_GeneratedFilesOutput.md ├── benchmark ├── benchmark │ └── Facet.Benchmark │ │ ├── quick-test.ps1 │ │ └── QuickTestBenchmark.cs ├── super-quick-test.ps1 ├── Facet.Benchmark │ ├── Facet.Benchmark.csproj │ ├── SuperQuickBenchmark.cs │ ├── FacetDTOs.cs │ ├── MapperlyMappers.cs │ └── ManualDTOs.cs ├── quick-test.ps1 └── FacetBenchmark.sln ├── .gitattributes ├── Directory.Build.props └── Directory.Packages.props /assets/Facet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tim-Maes/Facet/HEAD/assets/Facet.png -------------------------------------------------------------------------------- /assets/FacetLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tim-Maes/Facet/HEAD/assets/FacetLogo.png -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [Tim-Maes] 4 | custom: ["https://www.paypal.me/TimMaes91", "https://www.buymeacoffee.com/GRq3xSA"] 5 | -------------------------------------------------------------------------------- /src/Facet/AnalyzerReleases.Unshipped.md: -------------------------------------------------------------------------------- 1 | ; Unshipped analyzer release 2 | ; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md 3 | -------------------------------------------------------------------------------- /test/Facet.Tests/UnitTests/Core/GenerateDtos/GenerateDtosErrorHandlingTests.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tim-Maes/Facet/HEAD/test/Facet.Tests/UnitTests/Core/GenerateDtos/GenerateDtosErrorHandlingTests.cs -------------------------------------------------------------------------------- /src/Facet.Dashboard/Templates/member-row.html: -------------------------------------------------------------------------------- 1 |
| Name | 5 |Type | 6 |Modifiers | 7 |
|---|
No types with [Facet] attribute were discovered in your assemblies.
9 |Make sure your facet types are public and the assemblies are loaded.
10 |
14 | /// // Instead of implementing IFacetMapConfigurationWithReturn
15 | /// var dto = MyDto.FromSource(source); // Uses generated factory method
16 | ///
17 | ///
41 | /// // Instead of implementing IFacetMapConfigurationWithReturnInstance
42 | /// var dto = MyDto.FromSource(source); // Uses generated factory method
43 | ///
44 | ///
16 | /// public class MyMapper :
17 | /// IFacetMapConfiguration<TSource, TTarget>,
18 | /// IFacetMapConfigurationAsync<TSource, TTarget>
19 | /// {
20 | /// public static void Map(TSource source, TTarget target) { ... }
21 | /// public static Task MapAsync(TSource source, TTarget target, CancellationToken ct) { ... }
22 | /// }
23 | ///
24 | ///
49 | /// public class MyMapper :
50 | /// IFacetMapConfigurationInstance<TSource, TTarget>,
51 | /// IFacetMapConfigurationAsyncInstance<TSource, TTarget>
52 | /// {
53 | /// public void Map(TSource source, TTarget target) { ... }
54 | /// public Task MapAsync(TSource source, TTarget target, CancellationToken ct) { ... }
55 | /// }
56 | ///
57 | ///
34 | /// [Facet(typeof(Order))]
35 | /// public partial class OrderDto
36 | /// {
37 | /// public OrderStatus Status { get; set; }
38 | ///
39 | /// [MapWhen("Status == OrderStatus.Completed")]
40 | /// public DateTime? CompletedAt { get; set; }
41 | ///
42 | /// [MapWhen("Price != null", Default = 0)]
43 | /// public decimal Price { get; set; }
44 | /// }
45 | ///
46 | ///
80 | /// [MapWhen("HasPrice", Default = 0)]
81 | /// public decimal Price { get; set; }
82 | ///
83 | ///
33 | /// [Facet(typeof(User))]
34 | /// public partial class UserDto
35 | /// {
36 | /// [MapFrom("FirstName")]
37 | /// public string Name { get; set; }
38 | ///
39 | /// [MapFrom("Company.Name")]
40 | /// public string CompanyName { get; set; }
41 | ///
42 | /// [MapFrom("FirstName + \" \" + LastName", Reversible = false)]
43 | /// public string FullName { get; set; }
44 | /// }
45 | ///
46 | ///