private void GenerateViewModel(ITypeModelRegistry registry, ViewModel viewModel, ClassModel @class) { foreach (var property in viewModel.Properties) { @class.AddViewModelProperty(property.Denormalized(), registry); } if (viewModel.Target != null) { foreach (var property in viewModel.Target.Properties) { @class.AddViewModelProperty(property.Denormalized(), registry); } } }
private static void AddViewModelProperty(ITypeModelRegistry registry, ClassModel @class, Property property) { if (property.Type.Type is Aggregate aggregate && aggregate.UniqueIdentifier != null) { @class.AddViewModelProperty(new Property { Name = property.IsCollection ? property.Name : $"{property.Name}{aggregate.UniqueIdentifier.Name}", IsCollection = property.IsCollection, Type = aggregate.UniqueIdentifier.Type }.Denormalized(), registry); }