src/Shared/EntityFramework/Core/Objects/DataClasses/StructuralObject.cs
/// <summary>Sets a complex object for the specified property.</summary>
/// <returns>A complex type that derives from complex object.</returns>
/// <param name="oldValue">The original complex object for the property, if any.</param>
/// <param name="newValue">The complex object is being set.</param>
/// <param name="property">The complex property that is being set to the complex object.</param>
/// <typeparam name="T">The type of the object being replaced.</typeparam>
Sets a complex object for the specified property.
Sets a complex object for the specified property .
protected internal T SetValidValue<T>(T oldValue, T newValue, string property) where T : ComplexObject
        {
            if (newValue == null && IsChangeTracked)
            {
                throw new InvalidOperationException(Strings.ComplexObject_NullableComplexTypesNotSupported(property));
            }
            if (oldValue != null)
            {
                oldValue.DetachFromParent();
            }
            if (newValue != null)
            {
                newValue.AttachToParent(this, property);
            }
            return newValue;
        }
protected internal T SetValidValue < T > ( T oldValue , T newValue , string property ) where T : ComplexObject { if ( newValue == null && IsChangeTracked ) { throw new InvalidOperationException ( Strings . ComplexObject_NullableComplexTypesNotSupported ( property ) ) ; } if ( oldValue != null ) { oldValue . DetachFromParent ( ) ; } if ( newValue != null ) { newValue . AttachToParent ( this , property ) ; } return newValue ; }
Sets a complex object for the specified property.
Sets a complex object for the specified property .
// Nullable complex types are not supported in v1, but we allow setting null here if the parent entity is detached
A complex type that derives from complex object.
A complex type that derives from complex object .
oldValue
T
The original complex object for the property, if any.
The original complex object for the property if any .
newValue
T
The complex object is being set.
The complex object is being set .
property
string
The complex property that is being set to the complex object.
The complex property that is being set to the complex object .
typeparam
The type of the object being replaced.
The type of the object being replaced .