Kjelli wrote:
Do i need to implement the PerformGetDbCount event as well (how?) ?
Only if you're using paging.
you then should do something like:
e.DbCount = <select db count from db here>
This is what I did after your response:
void ds_PerformSelect(object sender, PerformSelectEventArgs e)
{
e.ContainedCollection.GetMulti(e.Filter, -1, e.Sorter, e.Relations, e.PrefetchPath);
}
void ds_PerformWork(object sender, PerformWorkEventArgs e)
{
e.Uow.Commit(new Transaction(IsolationLevel.ReadCommitted, "UOW"), true);
}
Is that all that's needed? It seems to be working all right so far.
I was comfortable using the livepersistence = true thing. I would appreciate a way to get the new identifier that way, perhaps in the DetailsView ItemInserted event. Are you sure that's not possible? The item is supposed to have been written at that point.
yes, but it's not the concern nor the goal of the datasourcecontrol to do all kind of housekeeping jobs some control has to do nor can it possibly offer functionality to work with every control out there which needs special attention: it simply does what it should do: act when any of the Execute* methods is called. That's it. It can't do more.
EDIT: I was kinda quick in my response
I found the new identifier while debugging, but the property I used is not public. In fact there are no public properties on the UoW object. So the question still remains, how can I get the identifier (in the performwork event)?
To get the entities which are about to be saved in a unitofwork:
e.UoW.ConstructSaveProcessQueues();
List<ActionQueueElement<IEntity>> insertQueue = e.UoW.GetInsertQueue();
List<ActionQueueElement<IEntity>> updateQueue = e.UoW.GetUpdateQueue();
the entities to update/insert are in the actionqueueelement objects in the queues returned. In most cases, there won't be more than 1 entity to save.