How can I use data binding on a details form to add a new entity to my data source? I have created an Object data source, and dragged it onto my form as 'details', which automatically adds a bindingSource and bindingNavigator control to my form, in addition to data bound detail fields. I have the following code which all executes with no exceptions, but no new Branch record gets added when I click 'Add New' and then 'Save'.
private void BranchEditForm_Load(object sender, EventArgs e)
{
branchBindingSource.DataSource = _loansEntities.Branches;
}
private void branchBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
_loansEntities.SaveChanges(SaveOptions.AcceptAllChangesAfterSave);
}
I can't seem to find any Entity Framework data binding examples that don't just default to grids.