src/Shared/EntityFramework/Core/Common/Utils/CommandHelper.cs
// <summary>
// Given an entity command, store provider command and a connection, sets all output parameter values on the entity command.
// The connection is used to determine how to map spatial values.
// </summary>
// <param name="entityCommand"> Entity command on which to set parameter values. Must not be null. </param>
// <param name="storeProviderCommand"> Store provider command from which to retrieve parameter values. Must not be null. </param>
// <param name="connection"> The connection on which the command was run. Must not be null </param>
Given an entity command, store provider command and a connection, sets all output parameter values on the entity command.
The connection is used to determine how to map spatial values.
Given an entity command store provider command and a connection sets all output parameter values on the entity command . The connection is used to determine how to map spatial values .
internal static void SetEntityParameterValues(
            EntityCommand entityCommand, DbCommand storeProviderCommand, EntityConnection connection)
        {
            DebugCheck.NotNull(entityCommand);
            DebugCheck.NotNull(storeProviderCommand);
            DebugCheck.NotNull(connection);
            foreach (DbParameter storeParameter in storeProviderCommand.Parameters)
            {
                var direction = storeParameter.Direction;
                if (0 != (direction & ParameterDirection.Output))
                {
                    var parameterOrdinal = entityCommand.Parameters.IndexOf(storeParameter.ParameterName);
                    if (0 <= parameterOrdinal)
                    {
                        var entityParameter = entityCommand.Parameters[parameterOrdinal];
                        var parameterValue = storeParameter.Value;
                        var parameterType = entityParameter.GetTypeUsage();
                        if (Helper.IsSpatialType(parameterType))
                        {
                            parameterValue = GetSpatialValueFromProviderValue(
                                parameterValue, (PrimitiveType)parameterType.EdmType, connection);
                        }
                        entityParameter.Value = parameterValue;
                    }
                }
            }
        }
internal static void SetEntityParameterValues ( EntityCommand entityCommand , DbCommand storeProviderCommand , EntityConnection connection ) { DebugCheck . NotNull ( entityCommand ) ; DebugCheck . NotNull ( storeProviderCommand ) ; DebugCheck . NotNull ( connection ) ; foreach ( DbParameter storeParameter in storeProviderCommand . Parameters ) { var direction = storeParameter . Direction ; if ( 0 != ( direction & ParameterDirection . Output ) ) { var parameterOrdinal = entityCommand . Parameters . IndexOf ( storeParameter . ParameterName ) ; if ( 0 <= parameterOrdinal ) { var entityParameter = entityCommand . Parameters [ parameterOrdinal ] ; var parameterValue = storeParameter . Value ; var parameterType = entityParameter . GetTypeUsage ( ) ; if ( Helper . IsSpatialType ( parameterType ) ) { parameterValue = GetSpatialValueFromProviderValue ( parameterValue , ( PrimitiveType ) parameterType . EdmType , connection ) ; } entityParameter . Value = parameterValue ; } } } }
Given an entity command, store provider command and a connection, sets all output parameter values on the entity command.
Given an entity command store provider command and a connection sets all output parameter values on the entity command .
// if the entity command also defines the parameter, propagate store parameter value // to entity parameter
entityCommand
EntityCommand
Entity command on which to set parameter values. Must not be null.
Entity command on which to set parameter values . Must not be null .
storeProviderCommand
DbCommand
Store provider command from which to retrieve parameter values. Must not be null.
Store provider command from which to retrieve parameter values . Must not be null .
connection
EntityConnection
The connection on which the command was run. Must not be null
The connection on which the command was run . Must not be null