Trying to use Mapperly with the MvvmToolkit [ObservableProperty] #1445
Closed
cconner100
started this conversation in
General
Replies: 1 comment 1 reply
-
Chaining source generators is not supported by .NET. See #883, #292, #533, FAQ and dotnet/roslyn#57239. |
Beta Was this translation helpful? Give feedback.
1 reply
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
Hi,
trying to use the mapperly mapper to map between a ViewModel which contains MvvmToolkit generated fields and a model which contains a standard dto, here is an example
`public partial class ChartOfAccountLineItem : ObservableObject
{
[ObservableProperty]
string? dealershipName;
}
[Mapper(UseDeepCloning = true, IncludedMembers = MemberVisibility.Public)]
public partial class AccountMapper
{
//TODO: map the correct property
[MapProperty(nameof(AccountListItemDto.Name), nameof(ChartOfAccountLineItem.Name))]
[MapProperty(nameof(AccountListItemDto.AccountNumber), nameof(ChartOfAccountLineItem.AccountNumber))]
[MapProperty(nameof(AccountListItemDto.AccountType), nameof(ChartOfAccountLineItem.AccountType))]
[MapProperty(nameof(AccountListItemDto.AccountSubType), nameof(ChartOfAccountLineItem.AccountSubType))]
[MapProperty(nameof(AccountListItemDto.ExpenseRatioCategory), nameof(ChartOfAccountLineItem.ExpenseRatioCategory))]
[MapProperty(nameof(AccountListItemDto.ScheduledAccountName), nameof(ChartOfAccountLineItem.ScheduledAccount))]
[MapProperty(nameof(AccountListItemDto.CurrentBalance), nameof(ChartOfAccountLineItem.CurrentBalance))]
}
public sealed class AccountListItemDto
{
public string? AccountNumber { get; set; }
public string? AccountSubType { get; set; }
public string? AccountSubTypeName { get; set; }
public AccountTypeEnum? AccountType { get; set; }
public string? AccountTypeName { get; set; }
public bool AllowDelete { get; set; }
public bool AllowEditBalance { get; set; }
public bool AllowViewRegister { get; set; }
public string? ChildIds { get; set; }
public decimal CurrentBalance { get; set; }
public string? Description { get; set; }
public int ParentId { get; set; }
public bool IsHeader { get; set; }
public int Level { get; set; }
public decimal OpeningBalance { get; set; }
public DateTime OpeningBalanceDate { get; set; }
public bool ShowBalance { get; set; }
public bool ShowTrackDepreciation { get; set; }
public int ScheduledAccountId { get; set; }
public int ControlTypeId { get; set; }
public string? ControlTypeName { get; set; }
public string? ScheduledAccountName { get; set; }
public string? Classification { get; set; }
public int Seq { get; set; }
public string? AccountDeptCode { get; set; }
public int AccountDeptId { get; set; }
public string? ExpenseRatioCategory { get; set; }
}`
When i try to map the ChartOfAccountLineItem to the AccountListItemDto i get the following issues
error RMG005: Specified member AccountNumber on mapping target type AccountingViewModel.ChartOfAccountLineItem was not found
It seems like its not finding the generated code from the mvvm toolkit at generation time, is there an option to correct this? or an order how i need to build for this to work?
Beta Was this translation helpful? Give feedback.
All reactions