EFIngresProvider/EFIngresProviderServices.cs
/// <summary>
/// Create an EFIngresCommand object, given the provider manifest and command tree
/// </summary>
Create an EFIngresCommand object, given the provider manifest and command tree
Create an EFIngresCommand object given the provider manifest and command tree
private DbCommand CreateCommand(DbProviderManifest manifest, DbCommandTree commandTree)
        {
            if (commandTree == null) throw new ArgumentNullException("commandTree");
            var ingresManifest = Cast<EFIngresProviderManifest>(manifest, "manifest");
            var version = ingresManifest.Version;
            var command = new EFIngresCommand();
            List<DbParameter> parameters;
            CommandType commandType;
            command.CommandText = SqlGenerator.GenerateSql(commandTree, version, out parameters, out commandType);
            command.CommandType = commandType;
            if (command.CommandType == CommandType.Text)
            {
            }
            EdmFunction function = null;
            if (commandTree is DbFunctionCommandTree)
            {
                function = ((DbFunctionCommandTree)commandTree).EdmFunction;
            }
            command.Parameters.AddRange(commandTree.Parameters.Select(queryParameter => CreateDbParameter(queryParameter.Key, queryParameter.Value, ParameterMode.In, DBNull.Value)).ToArray());
            if (parameters != null && parameters.Count > 0)
            {
                if (!(commandTree is DbModificationCommandTree))
                {
                    throw new InvalidOperationException("SqlGenParametersNotPermitted");
                }
                command.Parameters.AddRange(parameters.ToArray());
            }
            return command;
        }
private DbCommand CreateCommand ( DbProviderManifest manifest , DbCommandTree commandTree ) { if ( commandTree == null ) throw new ArgumentNullException ( " " ) ; var ingresManifest = Cast < EFIngresProviderManifest > ( manifest , " " ) ; var version = ingresManifest . Version ; var command = new EFIngresCommand ( ) ; List < DbParameter > parameters ; CommandType commandType ; command . CommandText = SqlGenerator . GenerateSql ( commandTree , version , out parameters , out commandType ) ; command . CommandType = commandType ; if ( command . CommandType == CommandType . Text ) { } EdmFunction function = null ; if ( commandTree is DbFunctionCommandTree ) { function = ( ( DbFunctionCommandTree ) commandTree ) . EdmFunction ; } command . Parameters . AddRange ( commandTree . Parameters . Select ( queryParameter => CreateDbParameter ( queryParameter . Key , queryParameter . Value , ParameterMode . In , DBNull . Value ) ) . ToArray ( ) ) ; if ( parameters != null && parameters . Count > 0 ) { if ( ! ( commandTree is DbModificationCommandTree ) ) { throw new InvalidOperationException ( " " ) ; } command . Parameters . AddRange ( parameters . ToArray ( ) ) ; } return command ; }
Create an EFIngresCommand object, given the provider manifest and command tree
Create an EFIngresCommand object given the provider manifest and command tree
//command.CommandText += Environment.NewLine + Environment.NewLine + "-- provider: " + this.GetType().Assembly.FullName; // Get the function (if any) implemented by the command tree since this influences our interpretation of parameters // Now make sure we populate the command's parameters from the CQT's parameters: // Now add parameters added as part of SQL gen (note: this feature is only safe for DML SQL gen which // does not support user parameters, where there is no risk of name collision)
manifest
DbProviderManifest
commandTree
DbCommandTree