Print Page | Close Window

Problem in RejectChanges

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2227
Printed Date: 13-Jul-2026 at 9:20am


Topic: Problem in RejectChanges
Posted By: bala
Subject: Problem in RejectChanges
Date Posted: 13-Oct-2010 at 12:34pm
Hi There
I would come across one problem.
I want to undo my changes So I am using RejectChanges();
Its working with Single table but when I used many to many to relation and
RejectChanges fail to give result.

Any suggestions...


Thanks






Replies:
Posted By: DenisK
Date Posted: 13-Oct-2010 at 4:46pm
Hi Bala;

Could you give more detail as to how the RejectChanges failed to give result?


Posted By: bala
Date Posted: 14-Oct-2010 at 4:39am

 private void btnRemoverProfissao_Click(object sender, RoutedEventArgs e)
        {
            if (agDataGrid3.SelectedRowsCount != 0)
            {
                PESSOA_PROFISSAO profissao = (PESSOA_PROFISSAO)DataGrid.FocusedDataRow;
                PessoaProfissaoGrupo.PESSOA_PROFISSAO.Remove(profissao);
                Profissoes.Remove(profissao);
            }
            else
                MessageBox.Show("Select a Profession to remove.");
        }

private void CancelButton_Click(object sender, RoutedEventArgs e)

        {
            _em.RejectChanges();
            this.DialogResult = false;
        }

The above code in Child Window I click remove then click on cancel.

(I am not executing _em.saveAsync())

Then I move to other menu and doing other  operation like saving other records

and _em Executing  PessoaProfissaoGrupo.PESSOA_PROFISSAO.Remove(profissao); this records

I expect after i cancel _em should be reject my changes.


Thanks



Posted By: Molinari
Date Posted: 18-Oct-2010 at 3:11am
I having the same problem.
if anyone knows how to solve ...

help ...

Thanks...


Posted By: DenisK
Date Posted: 19-Oct-2010 at 5:35pm
Hi bala;

Try using EntityAspect.Delete() method instead.


Posted By: Molinari
Date Posted: 20-Oct-2010 at 4:29am
where in the code.
because this command does not exist in many to many...

Need to remove from many to many. Not from the object itself.

Correct me if i wrong.


Posted By: ting
Date Posted: 20-Oct-2010 at 6:47pm
We have confirmed this as a bug.  We'll get it fixed.



Posted By: bala
Date Posted: 21-Oct-2010 at 9:26am
Hey Ting

I am doing same..
but can you put light how to manage this code for mean while..

Thanks




Posted By: ting
Date Posted: 25-Oct-2010 at 9:48pm
Hi bala,

I don't know if there is a great workaround.  You can explicitly map the mapping table (many-to-many with payload) and manage the mapping entity manually, but that seems like too much work.

You can also try removing the relationship again after the RejectChanges(), so if you later call SaveChanges(), the record should not be saved.

This should be fixed in our next release (about 6 weeks).



Posted By: ting
Date Posted: 09-Dec-2010 at 2:42pm
This has been fixed and is available in DevForce 6.0.7.



Print Page | Close Window