private IReadOnlyCollection <VCEntityLinkingViewModel> GetEntityLinkingModels( IEntityServiceModel entityModel) { return(entityModel.GetType() .GetProperties(BindingFlags.Public | BindingFlags.Instance) .Where(p => p.PropertyType == typeof(IReadOnlyCollection <EntityLinkingModel>)) .Select(p => new VCEntityLinkingViewModel { Name = p.Name, EntityLinkings = (IReadOnlyCollection <EntityLinkingModel>)p.GetValue(entityModel), }) .ToList()); }
public IViewComponentResult Invoke(IEntityServiceModel entityModel) { var items = this.GetEntityLinkingModels(entityModel); if (entityModel.Description == null) { entityModel.Description = DefaultDescription; } var vcModel = new VCEntityViewModel { Id = entityModel.Id, EntityTypeName = this.entityNameExtractService.ExtractEntityTypeName(entityModel.GetType()), Description = entityModel.Description, EntityLinkings = items, }; return(this.View(vcModel)); }