src/Misc/EFTools/EntityDesignModel/Commands/ChangeFunctionImportCommand.cs
/// <summary>
///     Update the underlying function/store-procedure if they are changed.
/// </summary>
Update the underlying function/store-procedure if they are changed.
Update the underlying function / store - procedure if they are changed .
private void UpdateFunctionImportFunction(CommandProcessorContext cpc)
        {
            if (Function != FunctionImport.Function)
            {
                if (Function == null)
                {
                    DeleteEFElementCommand.DeleteInTransaction(cpc, FunctionImport.FunctionImportMapping);
                }
                else
                {
                    var functionImportMapping = FunctionImport.FunctionImportMapping;
                    if (functionImportMapping == null)
                    {
                        if (FunctionImport.Artifact != null
                            && FunctionImport.Artifact.MappingModel() != null
                            && FunctionImport.Artifact.MappingModel().FirstEntityContainerMapping != null)
                        {
                            var cmdFuncImpMapping = new CreateFunctionImportMappingCommand(
                                FunctionImport.Artifact.MappingModel().FirstEntityContainerMapping,
                                Function,
                                FunctionImport);
                            CommandProcessor.InvokeSingleCommand(cpc, cmdFuncImpMapping);
                        }
                    }
                    else
                    {
                        functionImportMapping.FunctionName.SetRefName(Function);
                        AddToBeNormalizedEFContainerItem(functionImportMapping);
                    }
                }
                CreateFunctionImportCommand.UpdateFunctionImportParameters(cpc, FunctionImport, Function);
            }
        }
private void UpdateFunctionImportFunction ( CommandProcessorContext cpc ) { if ( Function != FunctionImport . Function ) { if ( Function == null ) { DeleteEFElementCommand . DeleteInTransaction ( cpc , FunctionImport . FunctionImportMapping ) ; } else { var functionImportMapping = FunctionImport . FunctionImportMapping ; if ( functionImportMapping == null ) { if ( FunctionImport . Artifact != null && FunctionImport . Artifact . MappingModel ( ) != null && FunctionImport . Artifact . MappingModel ( ) . FirstEntityContainerMapping != null ) { var cmdFuncImpMapping = new CreateFunctionImportMappingCommand ( FunctionImport . Artifact . MappingModel ( ) . FirstEntityContainerMapping , Function , FunctionImport ) ; CommandProcessor . InvokeSingleCommand ( cpc , cmdFuncImpMapping ) ; } } else { functionImportMapping . FunctionName . SetRefName ( Function ) ; AddToBeNormalizedEFContainerItem ( functionImportMapping ) ; } } CreateFunctionImportCommand . UpdateFunctionImportParameters ( cpc , FunctionImport , Function ) ; } }
Update the underlying function/store-procedure if they are changed.
Update the underlying function / store - procedure if they are changed .
// if the user selected "(None)" then delete the FunctionImportMapping // if the user selected another stored procedure, update the mapping // and the parameters of the function import // if there isn't a FunctionImportMapping already, we need to create it with the FunctionName // update the FunctionName in the FunctionImportMapping // finally, update the parameters of the function import to match the function
cpc
CommandProcessorContext