c# - WinForm for creating ADO.NET Entities that have relationships with other entities -
I am very new to the ADO unit framework, and I am looking for the best practice
here The scenario is: I have a database with a person
table and a address
table. In person
, there is a foreign key that refers to the primary key of the address
, an auto-expand int first, I have the VS. 2010 has prepared an ADO unit model, and it is certain that the relationship is understood by the IDE.
Now I want to create a Windows form that gives the user the basic information of person
and address
. Normally, I can simply drag the person
unit to blank windows form, and VS 22010 will automatically create required fields with the binding. But when this form fills by the user, I have to do extra work to ensure the following:
- Form
address
is partaddress < / Code> table
- has saved the
person
information, with the primary code saved in theperson
tableaddress
Made in 1. - The user never touches / looks at the primary key.
I think my illusion is coming from the fact that I expect the IDE to do more coding than that; If I had to hop it as soon as possible, then maybe I would add a click event to the "Save" button, which first calls to SaveChanges () on the person
by person
is. Is this the best practice, or is there a more acceptable way of doing this?
You should not do too much, but you should contact the person (usually different / delete) To handle correctly the scenarios taken), the datachaintext should call SaveChanges.
You should simply remove all the control (columns) related to the key.
Do you have a specific problem?
Comments
Post a Comment