CSLA and Web Services - default values

CSLA and Web Services - default values

Old forum URL: forums.lhotka.net/forums/t/6924.aspx


jmcd posted on Monday, May 11, 2009

We are exposing an existing CSLA solution to the outside world via Web Services and have come across an interesting problem.  The business objects have default values which we want to be used when the client has not explicitly set a value in the DTO.  However, using standard nullable types there is no way to tell if a client has explicitly meant "set this to null" or just not set it.

In the Expert C# 2008 Business Objects book, page 708 and 710 show values simply being copied over from the DTO to the business object, so no such checks are performed.

We've thought of a couple of potential solutions (we could expose an "IsSet" flag for each property or we could expose each property as a class which has a .Value and .IsSet property).

Any thoughts or recommendation about how to proceed would be most appreciated.

ajj3085 replied on Monday, May 11, 2009

You'll have to include a flag to indicate if the user explicitly set or didn't set the value, if you need to know that.

Copyright (c) Marimer LLC