I am having a real problem with handling nulls...

Nov 29, 2012 at 9:53 PM
Edited Nov 29, 2012 at 9:55 PM

Hi All,

I am new here, and to Value Injector which looks excellent. However I think I am suffering from user ignorance. I am trying to ignore nulls in a MVC Model("Source") which seem to be overwritting my Document model properties("Target").

I have the full question on StackOverflow at:

StackOverflow Question

I would hugely appreciate any help.

Many thanks,


Nov 29, 2012 at 10:07 PM

answered to so question

Nov 29, 2012 at 10:32 PM
Edited Nov 29, 2012 at 10:35 PM


Thanks for this, but it does not seem to work. You will see from my debugger screens that I am dealing with properties that contain classes ie "Client". I was wondering whether the issue was to do with the fact that the form had a subset of the Class Properties, but the Model Binder would just set these properties to null anyway, and the ValueInjector would process the object and not the forms collection.

I really appreciate your help. Thanks.


P.S This is also on SO.

Nov 29, 2012 at 11:49 PM


I believe the issue is to do with nested subclasses since the toplevel is never null which ValueInjecter seems to be checking. It has a value of {XSD_Smart2.DocumentIntroduction} for example as detailed by the debugger. Perhaps this is why

&& c.SourceProp.Value != null;

will not work, and I need something a little more involved to check the nesting.



Nov 30, 2012 at 12:00 AM


I think  I need something like the "Deep Cloning" approach, but does this take care of nested classes? Obviously there are the standard types like arrays, lists etc.

I think I am getting warmer.....