Source/Csla/Core/ManagedObjectBase.cs
/// <summary>
/// Loads a property's managed field with the 
/// supplied value calling PropertyHasChanged 
/// if the value does change.
/// </summary>
/// <param name="propertyInfo">
/// PropertyInfo object containing property metadata.</param>
/// <param name="newValue">
/// The new value for the property.</param>
/// <remarks>
/// No authorization checks occur when this method is called,
/// and no PropertyChanging or PropertyChanged events are raised.
/// Loading values does not cause validation rules to be
/// invoked.
/// </remarks>
Loads a property's managed field with the
supplied value calling PropertyHasChanged
if the value does change.
Loads a property ' s managed field with the supplied value calling PropertyHasChanged if the value does change .
protected void LoadPropertyConvert<P, F>(PropertyInfo<P> propertyInfo, F newValue)
    {
      try
      {
        P oldValue = default(P);
        var fieldData = FieldManager.GetFieldData(propertyInfo);
        if (fieldData == null)
        {
          oldValue = propertyInfo.DefaultValue;
          fieldData = FieldManager.LoadFieldData<P>(propertyInfo, oldValue);
        }
        else
        {
          var fd = fieldData as FieldManager.IFieldData<P>;
          if (fd != null)
            oldValue = fd.Value;
          else
            oldValue = (P)fieldData.Value;
        }
        LoadPropertyValue<P>(propertyInfo, oldValue, Utilities.CoerceValue<P>(typeof(F), oldValue, newValue), false);
      }
      catch (Exception ex)
      {
        throw new PropertyLoadException(string.Format(Properties.Resources.PropertyLoadException, propertyInfo.Name, ex.Message));
      }
    }
protected void LoadPropertyConvert < P , F > ( PropertyInfo < P > propertyInfo , F newValue ) { try { P oldValue = default ( P ) ; var fieldData = FieldManager . GetFieldData ( propertyInfo ) ; if ( fieldData == null ) { oldValue = propertyInfo . DefaultValue ; fieldData = FieldManager . LoadFieldData < P > ( propertyInfo , oldValue ) ; } else { var fd = fieldData as FieldManager . IFieldData < P > ; if ( fd != null ) oldValue = fd . Value ; else oldValue = ( P ) fieldData . Value ; } LoadPropertyValue < P > ( propertyInfo , oldValue , Utilities . CoerceValue < P > ( typeof ( F ) , oldValue , newValue ) , false ) ; } catch ( Exception ex ) { throw new PropertyLoadException ( string . Format ( Properties . Resources . PropertyLoadException , propertyInfo . Name , ex . Message ) ) ; } }
Loads a property's managed field with the
supplied value calling PropertyHasChanged
if the value does change.
Loads a property ' s managed field with the supplied value calling PropertyHasChanged if the value does change .
propertyInfo
PropertyInfo<P>
PropertyInfo object containing property metadata.
PropertyInfo object containing property metadata .
newValue
F
The new value for the property.
The new value for the property .
remarks
No authorization checks occur when this method is called,
and no PropertyChanging or PropertyChanged events are raised.
Loading values does not cause validation rules to be
invoked.
No authorization checks occur when this method is called and no PropertyChanging or PropertyChanged events are raised . Loading values does not cause validation rules to be invoked .