private CodeModel TabToModelAisTemplater() { var variables = new HashSet <CodeModelVariable>(); //Loop through each row and form variable script values foreach (DataGridViewRow row in AisTemplaterGrid.Rows) { variables.Add( CodeModelVariable.CreateNew( GetCellValue <string>(row, templaterVariableAccessLevel), GetCellValue <string>(row, templaterVariableName), GetCellValue <string>(row, templaterAisVariableType), GetCellValue <string>(row, templaterAisVariableComment), GetCellValueInt(row, templaterAisVariableStringLength), GetCellValueBool(row, templaterAisVariableIsRequired), GetCellValueBool(row, templaterAisVariableIsPartOfUpdate), GetCellValueBool(row, templaterAisVariableIsPartOfCreateNew), GetCellValueBool(row, templaterAisVariableIsMultilanguage) )); } var model = CodeModel.CreateNew(AisTemplaterModelNameTextBox.Text, AisTemplaterNamespaceTextBox.Text, AisTemplaterClassSummaryTextBox.Text, AisTemplaterAggregateRootCheckBox.Checked, AisTemplaterIsUserManagedCheckBox.Checked, AisTemplaterIsValidityRangeCheckBox.Checked, variables, AisTemplaterContextTextBox.Text, AisTemplaterSubNamespaceTextBox.Text); aisModel = model; return(model); }