Hi sorry for any stupid questions, this is only my second week playing the EF framework.
I have in my database a Company table and a User table. What I would like to do is be able to enter the company info and then the user info on the same insert page.
I have created a custom page by copying the insert page into a company folder in my custom page folder. I have added a second details view and entity data source to the page in the init function I have the following code
DynamicDataManager1.RegisterControl(DetailsView1)
DynamicDataManager1.RegisterControl(DetailsView2)
table = DetailsDataSource.GetTable
DetailsDataSource2.ContextTypeName = DetailsDataSource.ContextTypeName
DetailsDataSource2.EntitySetName = "Users"
DetailsView1.RowsGenerator = New HideColumnFieldsManager(table, PageTemplate.Insert)
DetailsView2.RowsGenerator = New HideColumnFieldsManager(DetailsDataSource2.GetTable, PageTemplate.Insert)
In the design view I have set the AutoGenerateInsertButton to false for both detailsview
When I run the project it shows the two forms and validation works as expected. So I added a button and inside of the button I have the following code
Dim cont As New mycityisModel.mycityisEntities
cont.SaveChanges()
However in the saving changes function osm.GetObjectStateEntries(Data.EntityState.Added) or any other enum returns zero entries.
Obviously I am doing something wrong or misunderstanding something. I don't want to create a page with the fields added manually then in the button click event create the two entities and populate them from the fields then calling savechanges as this seems unnecessary and there is probably a way to do it with dynamicdata. Is what I am asking doable. I have till the end of the week to get comfortable with EF or otherwise I have to go back to creating all the classes and input forms myself :( EF is definitely the way forward :)
Any pointers are gratefully received