EntityFramework.MemoryJoin icon indicating copy to clipboard operation
EntityFramework.MemoryJoin copied to clipboard

Reuse the parameters if possible

Open 0Lucifer0 opened this issue 1 year ago • 0 comments

Would be nice if the parameters that already exists were reused. I believe the only change required for this are to move away from IList to IList<DbParameter> and use this in AppendRowsAsValues

    var parameter = value?.GetType().IsValueType == true ? parameters.FirstOrDefault(x => x.Value == value) : null;
                        var paramName = parameter?.ParameterName ?? $"{paramPattern}{i}";

                        if (parameter == null)
                        {
                            var param = command.CreateParameter();
                            param.ParameterName = paramName;
                            param.Value = value;
                            parameters.Add(param);
                            i++;
                        }

                        sb.Append(paramName);

0Lucifer0 avatar Apr 08 '23 03:04 0Lucifer0