private void AddMenuItem_Click(object sender, EventArgs e) { if (_models[tabControl.SelectedIndex].ReadOnly) { return; } ModelMapper mapper = new ModelMapper(); IDataModel model = _models[tabControl.SelectedIndex]; object entity = model.CreateNew(); DataMember[] members = mapper.CreateModel(model.DataType, entity, false).ToArray(); if (members.Any() && new ModelViewForm(members).ShowDialog() == DialogResult.OK) { model.Store(entity); model.SaveChanges(); dataGridView.DataSource = null; dataGridView.DataSource = model.Data; } }