D
Dan Mayolo
I tried following the steps I describe below in VS 2010, but to no avail:
· Create new Windows Forms App. Project
· Add new empty ADO EDM to Project
· Add new entity Customer with scalar properties FirstName and
LastName
· Generate db script with EDM
· Execute db script to create tables in the db
· Add new Object Data Source based on EDM Model1
· Select object Customer in Data Sources window and drop it on form
in form of Details view.
· All typical binding controls are created, all I need to do is to
enable the Save button.
I run the app, form is displayed. I can add new records and navigate between
them. I press save, but when I reinitialize the app, all data is lost. I
guess code on the form should only reference BindingDataSource, not the
ObjectContext directly?
I tried setting the customerBindingSource.DataSource = ctx.Customers and
saving changes via ctx.SaveChanges(), but still new entities are not added
correctly.
What is the minimum of the code I need to write to make this simple CRUD
example working?
Thanks!
Dan
· Create new Windows Forms App. Project
· Add new empty ADO EDM to Project
· Add new entity Customer with scalar properties FirstName and
LastName
· Generate db script with EDM
· Execute db script to create tables in the db
· Add new Object Data Source based on EDM Model1
· Select object Customer in Data Sources window and drop it on form
in form of Details view.
· All typical binding controls are created, all I need to do is to
enable the Save button.
I run the app, form is displayed. I can add new records and navigate between
them. I press save, but when I reinitialize the app, all data is lost. I
guess code on the form should only reference BindingDataSource, not the
ObjectContext directly?
I tried setting the customerBindingSource.DataSource = ctx.Customers and
saving changes via ctx.SaveChanges(), but still new entities are not added
correctly.
What is the minimum of the code I need to write to make this simple CRUD
example working?
Thanks!
Dan