/// <summary> /// Constructor /// </summary> private Mapper() { var mappings = new MappingCollection(); mappings.Add <SysModelDto, SysModel>(); mappings.Add <SysModel, SysModelDto>(); mappings.Add <MembershipDto, Membership>(); mappings.Add <Membership, MembershipDto>(); mappings.Add <UserDto, User>(); mappings.Add <User, UserDto>(); mappings.Add <UserDto, UserWithPassword>(); mappings.Add <UserWithPassword, UserDto>(); mappings.Add <User, UserWithPassword>(); mappings.Add <UserWithPassword, User>(); mappings.Add <ApplicationDto, Application>(); mappings.Add <Application, ApplicationDto>(); mappings.Add <RoleDto, Role>(); mappings.Add <Role, RoleDto>(); mappings.Add <OAuthProviderDto, OAuthProvider>(); mappings.Add <OAuthProvider, OAuthProviderDto>(); mappings.Add <RevokedTokenDto, RevokedToken>(); mappings.Add <RevokedToken, RevokedTokenDto>(); mappings.Add <EventDto, ErtisAuthEvent>(); mappings.Add <ErtisAuthEvent, EventDto>(); mappings.Add <WebhookDto, Webhook>(); mappings.Add <Webhook, WebhookDto>(); mappings.Add <WebhookRequestDto, WebhookRequest>(); mappings.Add <WebhookRequest, WebhookRequestDto>(); this.Implementation = new TinyMapperImpl(mappings); }
/// <summary> /// Constructor /// </summary> private Mapper() { var mappings = new MappingCollection(); mappings.Add <SysModelDto, SysModel>(); mappings.Add <SysModel, SysModelDto>(); mappings.Add <User, UserWithPasswordHash>(); mappings.Add <UserWithPasswordHash, User>(); mappings.Add <ApplicationDto, Application>(); mappings.Add <Application, ApplicationDto>(); mappings.Add <RoleDto, Role>(); mappings.Add <Role, RoleDto>(); mappings.Add <OAuthProviderDto, OAuthProvider>(); mappings.Add <OAuthProvider, OAuthProviderDto>(); mappings.Add <ActiveTokenDto, ActiveToken>(); mappings.Add <ActiveToken, ActiveTokenDto>(); mappings.Add <RevokedTokenDto, RevokedToken>(); mappings.Add <RevokedToken, RevokedTokenDto>(); mappings.Add <EventDto, ErtisAuthEvent>(); mappings.Add <ErtisAuthEvent, EventDto>(); mappings.Add <WebhookDto, Webhook>(); mappings.Add <Webhook, WebhookDto>(); mappings.Add <WebhookRequestDto, WebhookRequest>(); mappings.Add <WebhookRequest, WebhookRequestDto>(); mappings.Add <ClientInfoDto, ClientInfo>(); mappings.Add <ClientInfo, ClientInfoDto>(); mappings.Add <GeoLocationInfoDto, GeoLocationInfo>(); mappings.Add <GeoLocationInfo, GeoLocationInfoDto>(); this.Implementation = new TinyMapperImpl(mappings); this.CustomMappers = new CustomMapperCollection(); this.CustomMappers .Add(new CustomMapper <Membership, MembershipDto>((model) => model.ToDto())) .Add(new CustomMapper <MembershipDto, Membership>((dto) => dto.ToModel())) .Add(new CustomMapper <UserType, UserTypeDto>((model) => model.ToDto())) .Add(new CustomMapper <UserTypeDto, UserType>((dto) => dto.ToModel())) .Add(new CustomMapper <User, UserDto>((model) => model.ToDto())) .Add(new CustomMapper <UserDto, User>((dto) => dto.ToModel())) .Add(new CustomMapper <UserWithPasswordHash, UserDto>((model) => model.ToDto())) .Add(new CustomMapper <UserDto, UserWithPasswordHash>((dto) => new UserWithPasswordHash(dto.ToModel()) { PasswordHash = dto.PasswordHash })) .Add(new CustomMapper <Webhook, WebhookDto>((model) => model.ToDto())) .Add(new CustomMapper <WebhookDto, Webhook>((dto) => dto.ToModel())) .Add(new CustomMapper <MailHook, MailHookDto>((model) => model.ToDto())) .Add(new CustomMapper <MailHookDto, MailHook>((dto) => dto.ToModel())); }