internal override RecordEntryFormViewModel GetLoadRowViewModel(string subGridName, RecordEntryViewModelBase parentForm, Action <IRecord> onSave, Action onCancel) { var propertyInfo = ObjectToEnter.GetType().GetProperty(subGridName); if (propertyInfo.GetCustomAttribute <FormEntry>() != null) { //lets start a dialog to add it on complete var fieldMetadata = (EnumerableFieldMetadata)ObjectRecordService.GetFieldMetadata(propertyInfo.Name, ObjectToEnter.GetType().AssemblyQualifiedName); var newRecord = (ObjectRecord)ObjectRecordService.NewRecord(fieldMetadata.EnumeratedTypeQualifiedName); var newObject = newRecord.Instance; var recordService = new ObjectRecordService(newObject, ObjectRecordService.LookupService, ObjectRecordService.OptionSetLimitedValues, ObjectRecordService, subGridName, parentForm.ApplicationController); var viewModel = new ObjectEntryViewModel( () => onSave(new ObjectRecord(newObject)), onCancel, newObject, new FormController(recordService, new ObjectFormService(newObject, recordService), parentForm.FormController.ApplicationController), parentForm, subGridName, parentForm.OnlyValidate); return(viewModel); //ideally could hide the parent dialog temporarily and load this one } //if the object specifies use a form then use the form/dialog else { return(null); } }