Hi,
I've just tried to upgrade to CSLA 3.6 from 3.5.1 , but faced a confusing problem.
I have root object Role (from BusinessBase) which contains child RolePermissions (BusinessListBase of RolePermission).
When I call Role.Save() in 3.5.1 everything is ok.
In 3.6 however I get Null Reference exception in RolePermissions object:
private
void Child_Update(){
int _roleNo = (Parent as Role).RoleNo;
For some reason Parent is reset for RolePermissions object.
I've tried to debug it and found that the problem is that Role object is not properly cloned : after ObjectCloner.Clone() method is executed (it is done as part of Save operation) the newly created object graph is not correct. What I don't understand is why it happens :). The executed code source seems to be the same in 3.5.1. and 3.6. I'm using local data portal and .net 3.5. sp1, btw.
Any ideas?
In your UI is the save code like this:
mBO.Save() ' wrong!!
or like this:
mBO = mBO.Save() 'RIGHT
The local dataportal now acts like a remote dataportal so that bugs in your code show up earlier in the development process. The wrong code above used to work in earlier versions for a local dataportal. But then you app broke when you switched to a remote dataportal and you had to re-write parts of it once you figured this out. Rocky's goal was to make the local and remote dataportals act the same way so that your code only needed to be written (correctly) once.
Joe
Thanks for response.
Actually I call role = role.Save(), so it is not the source of the problem.
I'll try try to reproduce the problem in sample project and post it.
Copyright (c) Marimer LLC