New Posts New Posts RSS Feed: Entity.RowState
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Entity.RowState

 Post Reply Post Reply
Author
Darren View Drop Down
Newbie
Newbie
Avatar

Joined: 06-Jul-2007
Location: United Kingdom
Posts: 23
Post Options Post Options   Quote Darren Quote  Post ReplyReply Direct Link To This Post Topic: Entity.RowState
    Posted: 11-Feb-2008 at 8:55am
Cheers Jeff
 
I think i will take that approach.
Back to Top
jeffdoolittle View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 146
Post Options Post Options   Quote jeffdoolittle Quote  Post ReplyReply Direct Link To This Post Posted: 08-Feb-2008 at 9:50am
Just a thought, you probably shouldn't be setting your boolean property based on cell values changing in your DataGridView.  This tightly couples your entity to the DataGridView.  Instead, you may want to consider overriding the OnPropertyChanged event in your entity and then set your boolean property in that method override.

--Jeff


Edited by jeffdoolittle - 08-Feb-2008 at 9:50am
Back to Top
Darren View Drop Down
Newbie
Newbie
Avatar

Joined: 06-Jul-2007
Location: United Kingdom
Posts: 23
Post Options Post Options   Quote Darren Quote  Post ReplyReply Direct Link To This Post Posted: 08-Feb-2008 at 6:32am
Thanks Jeff
 
I ended up creating a RowToPersist boolean property of the class, and set it value after any cell value changed in the DataGridView.
 
Then just save individual entities from the grid.
 
 
Back to Top
jeffdoolittle View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 146
Post Options Post Options   Quote jeffdoolittle Quote  Post ReplyReply Direct Link To This Post Posted: 07-Feb-2008 at 8:44pm

If you just created the entities, then they are still going to be in the "Added" state until you actually persist them.  Entities only go to the state "Modified" if they start in the state "Unchanged".  When you create the entities, they will remain in state "Added" until you either persist them (and state will be "Unchanged") or delete them (changing state to "Detached").

 

Back to Top
Darren View Drop Down
Newbie
Newbie
Avatar

Joined: 06-Jul-2007
Location: United Kingdom
Posts: 23
Post Options Post Options   Quote Darren Quote  Post ReplyReply Direct Link To This Post Posted: 07-Feb-2008 at 9:03am
The problem i have is that my entity.rowstate does not seem to change even though i have edited the record.
 
I create 10 new blank entities using create method of my developer class.
They are then added to a new entitylist, which then in turn populates a datagridview.
 
I enter a value into one of my datagridview cells and jump to the next record.
At this point i would have thought that the rowstate changes.
 
Iam missing something here..?
 
 
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down