views:

28

answers:

0

I am doing a little testing with EF4. I have built a simple DB which contains one table: Table: Person Column: Id Column: Name

  • I have a windows form application that contains a form with a gridview.
  • I have the Model.edmx all setup and works correctly (tested without encapsulating the context).
  • I have now encapsulated the context into a generic repository (Repository). I am learning how to use Repository then I will work on UnitoOfWork.
    • My repository implements CRUD.
  • My Repository has a method that returns all entities (public List GetAll()).
  • The List is assigned to my bindingsource in my windows form. This works, great.

My Problem: I am a bit confused on how to persist data from the UI back to my datastore.

  • Do I have to setup some method on the form that checks for data that changes/ed?
  • How would I send that back to the repository? Do I have to attach it to the context?

I hope someone can give me some direction. Thanks to all in advance! Let me know if you have any questions.