src/Shared/EntityFramework/Internal/EntityEntries/InternalEntityEntry.cs
// <summary>
// Gets an internal object representing a scalar or complex property.
// The property may be a nested property on the given <see cref="InternalPropertyEntry" />.
// </summary>
// <param name="parentProperty"> The parent property entry, or null if this is a property directly on the entity. </param>
// <param name="propertyName"> Name of the property. </param>
// <param name="properties"> The property split out into its parts. </param>
// <param name="requestedType"> The type of object requested, which may be null or 'object' if any type can be accepted. </param>
// <param name="requireComplex">
// if set to <c>true</c> then the found property must be a complex property.
// </param>
// <returns> The entry. </returns>
Gets an internal object representing a scalar or complex property.
The property may be a nested property on the given .
Gets an internal object representing a scalar or complex property . The property may be a nested property on the given .
private InternalPropertyEntry Property(
            InternalPropertyEntry parentProperty, string propertyName, IList<string> properties, Type requestedType,
            bool requireComplex)
        {
            var isDotted = properties.Count > 1;
            var currentRequestedType = isDotted ? typeof(object) : requestedType;
            var declaringType = parentProperty != null ? parentProperty.EntryMetadata.ElementType : EntityType;
            var propertyMetadata = ValidateAndGetPropertyMetadata(properties[0], declaringType, currentRequestedType);
            if (propertyMetadata == null
                || ((isDotted || requireComplex) && !propertyMetadata.IsComplex))
            {
                if (isDotted)
                {
                    throw Error.DbEntityEntry_DottedPartNotComplex(properties[0], propertyName, declaringType.Name);
                }
                throw requireComplex
                          ? Error.DbEntityEntry_NotAComplexProperty(properties[0], declaringType.Name)
                          : Error.DbEntityEntry_NotAScalarProperty(properties[0], declaringType.Name);
            }
            var internalPropertyEntry = (InternalPropertyEntry)propertyMetadata.CreateMemberEntry(this, parentProperty);
            return isDotted
                       ? Property(
                           internalPropertyEntry, propertyName, properties.Skip(1).ToList(), requestedType,
                           requireComplex)
                       : internalPropertyEntry;
        }
private InternalPropertyEntry Property ( InternalPropertyEntry parentProperty , string propertyName , IList < string > properties , Type requestedType , bool requireComplex ) { var isDotted = properties . Count > 1 ; var currentRequestedType = isDotted ? typeof ( object ) : requestedType ; var declaringType = parentProperty != null ? parentProperty . EntryMetadata . ElementType : EntityType ; var propertyMetadata = ValidateAndGetPropertyMetadata ( properties [ 0 ] , declaringType , currentRequestedType ) ; if ( propertyMetadata == null || ( ( isDotted || requireComplex ) && ! propertyMetadata . IsComplex ) ) { if ( isDotted ) { throw Error . DbEntityEntry_DottedPartNotComplex ( properties [ 0 ] , propertyName , declaringType . Name ) ; } throw requireComplex ? Error . DbEntityEntry_NotAComplexProperty ( properties [ 0 ] , declaringType . Name ) : Error . DbEntityEntry_NotAScalarProperty ( properties [ 0 ] , declaringType . Name ) ; } var internalPropertyEntry = ( InternalPropertyEntry ) propertyMetadata . CreateMemberEntry ( this , parentProperty ) ; return isDotted ? Property ( internalPropertyEntry , propertyName , properties . Skip ( 1 ) . ToList ( ) , requestedType , requireComplex ) : internalPropertyEntry ; }
Gets an internal object representing a scalar or complex property.
Gets an internal object representing a scalar or complex property .
None
parentProperty
InternalPropertyEntry
The parent property entry, or null if this is a property directly on the entity.
The parent property entry or null if this is a property directly on the entity .
propertyName
string
Name of the property.
Name of the property .
properties
IList<string>
The property split out into its parts.
The property split out into its parts .
requestedType
Type
The type of object requested, which may be null or 'object' if any type can be accepted.
The type of object requested which may be null or ' object ' if any type can be accepted .
requireComplex
bool
if set to true
if set to true