This is a migrated thread and some comments may be shown as answers.

ObjectContainer.GetChanges() and Server-side business rules validation

3 Answers 81 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
gmendez
Top achievements
Rank 1
gmendez asked on 18 Nov 2009, 01:25 PM
Hello,

I have a distributed application based on WCF. Even I perform data validation at the client side, I also must do it at the server side and I also need to perform more complex business rules validation as well.
I tryied to pass my data to the server using the ObjectContainer.GetChanges() using the 'Changed' verification mode so the WCF message is as small as possible. That's ok, but in the case of a complex object, sometimes some parts of the object remain unchainged so they are null at the server side (which is obvious). The problem is that some data checks are failing because these 'sub-objects' are null and null values are not allowed in those cases (because of the system requirements). What I really need to do, I think, is to pass only changed objects and their entire network.
That's the tipical case of an invoice object. Supose I have at the client side an object container with 200 invoice objects. But I change only one, just at the header level. I would like to pass the changed header and all it's children objects  (the whole object network), but NOT the 200 invoices...
Is there any chance this could be done? If not, i think it could be a great addition for future versions.
Best regards,

Gonzalo

3 Answers, 1 is accepted

Sort by
0
Accepted
Jan Blessenohl
Telerik team
answered on 19 Nov 2009, 08:51 AM
Hi gmendez,
The trick is to first apply the changes to an object scope by using container.CopyTo.
Lets look and some pseudo code:

new container
container.Apply(changeset form client)
scope.txn.start
container.CopyTo(scope)
scope.doallverifications
scope.txn.commit/rollback

Even if there is not enough info in the container, you have everything in the scope.

All the best,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
gmendez
Top achievements
Rank 1
answered on 19 Nov 2009, 10:40 AM
...And thus, the null values would be loaded on demand as they are needed... right?

Best wishes,

Gonzalo
0
Jan Blessenohl
Telerik team
answered on 19 Nov 2009, 05:37 PM
Hi gmendez,
You got it.

Sincerely yours,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Development (API, general questions)
Asked by
gmendez
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
gmendez
Top achievements
Rank 1
Share this question
or