src/Shared/EntityFramework/Internal/EntityEntries/InternalEntityEntry.cs
// <summary>
// Appends a query for the properties in the entity to the given string builder that is being used to
// build the eSQL query.  This method may be called recursively to query for all the sub-properties of
// a complex property.
// </summary>
// <param name="queryBuilder"> The query builder. </param>
// <param name="prefix"> The qualifier with which to prefix each property name. </param>
// <param name="templateValues"> The dictionary that acts as a template for the properties to query. </param>
Appends a query for the properties in the entity to the given string builder that is being used to
build the eSQL query.  This method may be called recursively to query for all the sub-properties of
a complex property.
Appends a query for the properties in the entity to the given string builder that is being used to build the eSQL query . This method may be called recursively to query for all the sub - properties of a complex property .
private void AppendEntitySqlRow(
            StringBuilder queryBuilder, string prefix, InternalPropertyValues templateValues)
        {
            var commaRequired = false;
            foreach (var propertyName in templateValues.PropertyNames)
            {
                if (commaRequired)
                {
                    queryBuilder.Append(", ");
                }
                else
                {
                    commaRequired = true;
                }
                var quotedName = DbHelpers.QuoteIdentifier(propertyName);
                var templateItem = templateValues.GetItem(propertyName);
                if (templateItem.IsComplex)
                {
                    var nestedValues = templateItem.Value as InternalPropertyValues;
                    if (nestedValues == null)
                    {
                        throw Error.DbPropertyValues_CannotGetStoreValuesWhenComplexPropertyIsNull(
                            propertyName, EntityType.Name);
                    }
                    queryBuilder.Append("ROW(");
                    AppendEntitySqlRow(
                        queryBuilder, String.Format(CultureInfo.InvariantCulture, "{0}.{1}", prefix, quotedName),
                        nestedValues);
                    queryBuilder.AppendFormat(CultureInfo.InvariantCulture, ") AS {0}", quotedName);
                }
                else
                {
                    queryBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0}.{1} ", prefix, quotedName);
                }
            }
        }
private void AppendEntitySqlRow ( StringBuilder queryBuilder , string prefix , InternalPropertyValues templateValues ) { var commaRequired = false ; foreach ( var propertyName in templateValues . PropertyNames ) { if ( commaRequired ) { queryBuilder . Append ( " " ) ; } else { commaRequired = true ; } var quotedName = DbHelpers . QuoteIdentifier ( propertyName ) ; var templateItem = templateValues . GetItem ( propertyName ) ; if ( templateItem . IsComplex ) { var nestedValues = templateItem . Value as InternalPropertyValues ; if ( nestedValues == null ) { throw Error . DbPropertyValues_CannotGetStoreValuesWhenComplexPropertyIsNull ( propertyName , EntityType . Name ) ; } queryBuilder . Append ( " " ) ; AppendEntitySqlRow ( queryBuilder , String . Format ( CultureInfo . InvariantCulture , " " , prefix , quotedName ) , nestedValues ) ; queryBuilder . AppendFormat ( CultureInfo . InvariantCulture , " " , quotedName ) ; } else { queryBuilder . AppendFormat ( CultureInfo . InvariantCulture , " " , prefix , quotedName ) ; } } }
Appends a query for the properties in the entity to the given string builder that is being used to
build the eSQL query.
Appends a query for the properties in the entity to the given string builder that is being used to build the eSQL query .
// Call the same method recursively to get all the values of the complex property
queryBuilder
StringBuilder
The query builder.
The query builder .
prefix
string
The qualifier with which to prefix each property name.
The qualifier with which to prefix each property name .
templateValues
InternalPropertyValues
The dictionary that acts as a template for the properties to query.
The dictionary that acts as a template for the properties to query .