---
title: ResourceViewModelMapper
summary: API reference for ResourceViewModelMapper.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-24
library: SAIF.Resources
reference_type: package
---


# ResourceViewModelMapper

Reflection-based mapper that copies same-name properties between types and can emit VB property declarations for scaffolding.

## Purpose

- Support resource-to-view-model projection and view-model scaffolding based on matching public properties.

## Context

- Namespace: `SAIF.Resources`
- Assembly/package: `SAIF.ResourceFiles`

## Public members

| Member | Signature | Purpose |
| --- | --- | --- |
| `Map` | `Public Shared Function Map(Of TSource, TDestination, TPropertyType)() As TDestination` | Creates new source and destination instances, then copies matching same-name properties of the requested type. |
| `GetViewModelProperties` | `Public Shared Function GetViewModelProperties(Of TSource, TPropertyType)() As String` | Builds VB property declaration text for matching properties on a generic source type. |
| `GetViewModelProperties` | `Public Shared Function GetViewModelProperties(TSource As Type, TPropertyType As Type) As String` | Builds VB property declaration text for matching properties on runtime-supplied types. |

## Behavioral notes

- `Map(Of TSource, TDestination, TPropertyType)` creates new source and destination instances, collects source properties whose type matches `TPropertyType`, and copies values into destination properties with the same name and type.
- Both `GetViewModelProperties` overloads enumerate properties of a requested type and return VB `Public Property` declarations containing the current source values.

## Constraints and usage notes

- Only properties whose type exactly matches `TPropertyType` are copied or emitted.
- The mapped source and destination types must be instantiable through `Activator.CreateInstance(..., True)`.

## Sources

- `Resources\SAIF.Resources\Mappings\ResourceViewModelMapper.vb`
- `Resources\SAIF.Resources\SAIF.BOF.ResourceFiles.vbproj`
