New Posts New Posts RSS Feed: Deleting Objects
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Deleting Objects

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

Joined: 25-Nov-2009
Location: Tanzania
Posts: 8
Post Options Post Options   Quote amourrashid Quote  Post ReplyReply Direct Link To This Post Topic: Deleting Objects
    Posted: 15-Nov-2010 at 6:25am
Hello I have been playing around with IdeaBlade and many aspects appear straight but one thing that I don't understand why it is idesigned this way is the caching process.

I have a Contract table that has contract items as a mater detail relationship.

I have a form that displays a list of contracts in XtraGrid bound to bindingsource. When I try to delete a contract it gets deleted in the database but the list on the grid stays as it is. it is not updated. If I try to call contractBindingSource.ResetItems(false) I get an exception that the list is readonly.

The contractBindingSource.RemoveCurrent either does not work it gives an error.
So how can my Grid be in Sync with the EntityManager or how can I disable this caching stuff. I feel very frustrated coz I've tried every option I know.


This is what I do.

Contract _contract=contractBindingSource.Current as Contract;
_contract.EntityAspect.Delete();
//contractBindingSource.RemoveCurrent() raises an error
//_manager.RemoveEntity(_contract,true) has no effect
//contractBindingSource.ResetItems(false) raises error
_manager.SaveChanges();
_manager.AcceptChanges();

Now how can I refresh my cache?
Please If any one can help.
Thanks in advance.



Back to Top
jsobell View Drop Down
Groupie
Groupie
Avatar

Joined: 02-Apr-2009
Location: Australia
Posts: 80
Post Options Post Options   Quote jsobell Quote  Post ReplyReply Direct Link To This Post Posted: 15-Nov-2010 at 3:11pm
It sounds like your grid is not being informed of changes to its underlying dataset.
How have you bound the collection to the grid? If it's via a property, is that property an ObservableCollection, in which case it will update automatically, or is it a derived property of some sort in which case you'll have to raise the OnPropertyChanged event for that property.
I don't think this has anything to do with caching, and you can set the DefaultQueryStrategy to be DatasourceOnly if you want to prove it.

Back to Top
amourrashid View Drop Down
Newbie
Newbie
Avatar

Joined: 25-Nov-2009
Location: Tanzania
Posts: 8
Post Options Post Options   Quote amourrashid Quote  Post ReplyReply Direct Link To This Post Posted: 16-Nov-2010 at 5:41am
Thanks,
   I have an XtraGrid that is bound to a binding Source.
When the form loads I call something like this

var query=_manager.Contracts;
var op=query.ExecuteAsync();
op.Completed+=op_Completed;



And the op_Completed is like this

void op_Completed(object sender,EntityQueriedEventArgs<Contract> e)
{

if(e.IsCompleted)
{
     contractsBindingSource.DataSource=e.Results;
}


}

However I tried also to use List<Contract> and the same it does not work.

The Item gets geleted but the XtraGrid does not refresh and the Items just remains.

Thanks.
Back to Top
amourrashid View Drop Down
Newbie
Newbie
Avatar

Joined: 25-Nov-2009
Location: Tanzania
Posts: 8
Post Options Post Options   Quote amourrashid Quote  Post ReplyReply Direct Link To This Post Posted: 21-Nov-2010 at 10:59pm
A total disappointment.

I have been trying to convince my manager to go with devforce but there are still things that set me down.

It is really painful. The support......
Back to Top
jsobell View Drop Down
Groupie
Groupie
Avatar

Joined: 02-Apr-2009
Location: Australia
Posts: 80
Post Options Post Options   Quote jsobell Quote  Post ReplyReply Direct Link To This Post Posted: 22-Nov-2010 at 1:16am
These forums are for the free product, and when they are busy responding to registered users it sometimes gets quiet on the 'free advice' front.
Your problem is third party control related and not specific to DevForce, so perhaps you should try posting your question on the DevExpress forums. The handling of the entities, cached or not, is completely standard in DevForce, as they are simply standard .NET objects. If you have the problem here you will also have it with RIA (only it will probably be much harder to solve).
I notice in your code that you never save the collection of entities to a local collection, so I don't understand how you are ever calling the INotifyPropertyChanged on that results collection.
 
Look at some examples, read the sample code supplied, and resolve what appears to be a pretty simple problem yourself. As I've always found, solving your own problem in 30mins is quicker than waiting an indeterminate time for support response.
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 22-Nov-2010 at 10:31am
Hi amourrashid,
 
Sorry it took long to get back to you.
 
Like jsobell mentioned, it doesn't look like you are implementing OnPropertyChanged.
 
I'd suggest having an ObservableCollection<Contracts> so you can add support for PropertyChanged in your app.
 
You will find a few examples in our DevForce Resource Center (like in here and here) that make use of the PropertyChanged event.
 
Regards,
   sbelini.
Back to Top
amourrashid View Drop Down
Newbie
Newbie
Avatar

Joined: 25-Nov-2009
Location: Tanzania
Posts: 8
Post Options Post Options   Quote amourrashid Quote  Post ReplyReply Direct Link To This Post Posted: 30-Nov-2010 at 2:59am
Thank you all for encouraging me.
     Actually what I have concluded is that DevForce seems more geared to WPF and Silverlight. This is undeniable. My solution is in Windows forms where even the examples are very scarce nowadays.

I will try to contact devexpress where I have a universal subscription and they respond very quickly.

Thank you all.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down