PropertyInfo DefaultValue changing

PropertyInfo DefaultValue changing

Old forum URL:

decius posted on Tuesday, February 02, 2010

My BO's Default value for a propertyinfo is changing.

private static PropertyInfo SecondApproversProperty = RegisterProperty(c => c.SecondApprovers, "Second Approvers", Approvers.NewApprovers());

This is the only place that I explicitly set the default value. But as I edit my object, my default value changes! what could cause this to happen?

ajj3085 replied on Tuesday, February 02, 2010

DefaultValue isn't supported for child BO objects, only value types are supported.

Whats happening is every BO which has the SecondApproversProperty is getting the exact same reference to the child colletion.. so each root is using the same child.

Remove the default value from your RegisterProperty call, and set the property in your DataPortal_Create method.

am_fusion replied on Tuesday, February 02, 2010


We discovered this 'problem' (I realize this is working as designed) some time ago.  I wonder if we can request the ability to pass in a delegate that creates the default value.  This way we can specify default values for reference types.


Copyright (c) Marimer LLC