File tree Expand file tree Collapse file tree 1 file changed +0
-45
lines changed
Expand file tree Collapse file tree 1 file changed +0
-45
lines changed Original file line number Diff line number Diff line change @@ -18,48 +18,3 @@ Welcome to the Facet documentation! This index will help you navigate all availa
1818- [ Facet.Mapping Reference] ( ../src/Facet.Mapping/README.md ) : Complete Facet.Mapping Documentation
1919- [ Facet.Mapping.Expressions Reference] ( ../src/Facet.Mapping.Expressions/README.md ) : Complete Expression Mapping Documentation
2020
21- ## Quick Reference
22-
23- ### Basic Usage
24- ``` csharp
25- [Facet (typeof (User ))]
26- public partial class UserDto { }
27-
28- var userDto = user .ToFacet <UserDto >();
29- ```
30-
31- ### Custom Sync Mapping
32- ``` csharp
33- public class UserMapper : IFacetMapConfiguration <User , UserDto >
34- {
35- public static void Map (User source , UserDto target )
36- {
37- target .FullName = $" {source .FirstName } {source .LastName }" ;
38- }
39- }
40- ```
41-
42- ### Async Mapping
43- ``` csharp
44- public class UserAsyncMapper : IFacetMapConfigurationAsync <User , UserDto >
45- {
46- public static async Task MapAsync (User source , UserDto target , CancellationToken cancellationToken = default )
47- {
48- target .ProfilePicture = await GetProfilePictureAsync (source .Id , cancellationToken );
49- }
50- }
51-
52- var userDto = await user .ToFacetAsync <UserDto , UserAsyncMapper >();
53- ```
54-
55- ### Expression Mapping
56- ``` csharp
57- // Define business logic once for entities
58- Expression < Func < User , bool >> activeUsers = u => u .IsActive && ! u .IsDeleted ;
59-
60- // Transform to work with DTOs
61- Expression < Func < UserDto , bool >> activeDtoUsers = activeUsers .MapToFacet <UserDto >();
62-
63- // Use with collections
64- var filteredDtos = dtoCollection .Where (activeDtoUsers .Compile ()).ToList ();
65- ```
You can’t perform that action at this time.
0 commit comments