Skip to content

Latest commit

 

History

History
49 lines (40 loc) · 1.75 KB

File metadata and controls

49 lines (40 loc) · 1.75 KB

Facet Documentation Index

Welcome to the Facet documentation! This index will help you navigate all available guides and references for using Facet and its extensions.

Table of Contents

Quick Reference

Basic Usage

[Facet(typeof(User))]
public partial class UserDto { }

var userDto = user.ToFacet<User, UserDto>();

Custom Sync Mapping

public class UserMapper : IFacetMapConfiguration<User, UserDto>
{
    public static void Map(User source, UserDto target)
    {
        target.FullName = $"{source.FirstName} {source.LastName}";
    }
}

Async Mapping

public class UserAsyncMapper : IFacetMapConfigurationAsync<User, UserDto>
{
    public static async Task MapAsync(User source, UserDto target, CancellationToken cancellationToken = default)
    {
        target.ProfilePicture = await GetProfilePictureAsync(source.Id, cancellationToken);
    }
}

var userDto = await user.ToFacetAsync<User, UserDto, UserAsyncMapper>();