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:

  1. Form address is part address < / Code> table
  2. has saved the person information, with the primary code saved in the person table address Made in 1.
  3. 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

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -