mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	- 增加 Column 特性 RewriteSql 重读功能;
This commit is contained in:
		@@ -512,14 +512,5 @@
 | 
				
			|||||||
            <param name="that"></param>
 | 
					            <param name="that"></param>
 | 
				
			||||||
            <returns></returns>
 | 
					            <returns></returns>
 | 
				
			||||||
        </member>
 | 
					        </member>
 | 
				
			||||||
        <member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            批量注入 Repository,可以参考代码自行调整
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="services"></param>
 | 
					 | 
				
			||||||
            <param name="globalDataFilter"></param>
 | 
					 | 
				
			||||||
            <param name="assemblies"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
    </members>
 | 
					    </members>
 | 
				
			||||||
</doc>
 | 
					</doc>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -116,14 +116,17 @@ namespace FreeSql.DataAnnotations
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        public int Scale { get => _Scale ?? 0; set => _Scale = value; }
 | 
					        public int Scale { get => _Scale ?? 0; set => _Scale = value; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ///// <summary>
 | 
					 | 
				
			||||||
        ///// 写入格式化,比如 geography::STGeomFromText({0},4236)
 | 
					 | 
				
			||||||
        ///// </summary>
 | 
					 | 
				
			||||||
        //public string AuditWriteSql { get; set; }
 | 
					 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 设置重读功能<para></para>
 | 
					        /// 重写功能<para></para>
 | 
				
			||||||
        /// [Column(RereadSql = "{0}.STAsText()")]<para></para>
 | 
					        /// 比如:[Column(RewriteSql = "geography::STGeomFromText({0},4236)")]<para></para>
 | 
				
			||||||
        /// 查询:SELECT a.[id], a.[geo].STAsText() FROM table a
 | 
					        /// 插入:INSERT INTO [table]([geo]) VALUES(geography::STGeomFromText('...',4236))<para></para>
 | 
				
			||||||
 | 
					        /// 提示:更新也生效
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public string RewriteSql { get; set; }
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 重读功能<para></para>
 | 
				
			||||||
 | 
					        /// 比如:[Column(RereadSql = "{0}.STAsText()")]<para></para>
 | 
				
			||||||
 | 
					        /// 查询:SELECT a.[id], a.[geo].STAsText() FROM [table] a
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        public string RereadSql { get; set; }
 | 
					        public string RereadSql { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -115,11 +115,19 @@
 | 
				
			|||||||
            decimal/numeric 类型的小数位长度
 | 
					            decimal/numeric 类型的小数位长度
 | 
				
			||||||
            </summary>
 | 
					            </summary>
 | 
				
			||||||
        </member>
 | 
					        </member>
 | 
				
			||||||
 | 
					        <member name="P:FreeSql.DataAnnotations.ColumnAttribute.RewriteSql">
 | 
				
			||||||
 | 
					            <summary>
 | 
				
			||||||
 | 
					            重写功能<para></para>
 | 
				
			||||||
 | 
					            比如:[Column(RewriteSql = "geography::STGeomFromText({0},4236)")]<para></para>
 | 
				
			||||||
 | 
					            插入:INSERT INTO [table]([geo]) VALUES(geography::STGeomFromText('...',4236))<para></para>
 | 
				
			||||||
 | 
					            提示:更新也生效
 | 
				
			||||||
 | 
					            </summary>
 | 
				
			||||||
 | 
					        </member>
 | 
				
			||||||
        <member name="P:FreeSql.DataAnnotations.ColumnAttribute.RereadSql">
 | 
					        <member name="P:FreeSql.DataAnnotations.ColumnAttribute.RereadSql">
 | 
				
			||||||
            <summary>
 | 
					            <summary>
 | 
				
			||||||
            设置重读功能<para></para>
 | 
					            重读功能<para></para>
 | 
				
			||||||
            [Column(RereadSql = "{0}.STAsText()")]<para></para>
 | 
					            比如:[Column(RereadSql = "{0}.STAsText()")]<para></para>
 | 
				
			||||||
            查询:SELECT a.[id], a.[geo].STAsText() FROM table a
 | 
					            查询:SELECT a.[id], a.[geo].STAsText() FROM [table] a
 | 
				
			||||||
            </summary>
 | 
					            </summary>
 | 
				
			||||||
        </member>
 | 
					        </member>
 | 
				
			||||||
        <member name="M:FreeSql.DataAnnotations.ColumnFluent.Name(System.String)">
 | 
					        <member name="M:FreeSql.DataAnnotations.ColumnFluent.Name(System.String)">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -572,13 +572,12 @@ namespace FreeSql.Internal.CommonProvider
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        object val = col.GetDbValue(d);
 | 
					                        object val = col.GetDbValue(d);
 | 
				
			||||||
                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
					                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
				
			||||||
                        if (_noneParameter)
 | 
					
 | 
				
			||||||
                            sb.Append(_commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val));
 | 
					                        var colsql = _noneParameter ? _commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val) :
 | 
				
			||||||
                        else
 | 
					                            _commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}"));
 | 
				
			||||||
                        {
 | 
					                        sb.Append(_commonUtils.QuoteWriteColumn(col, colsql));
 | 
				
			||||||
                            sb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}")));
 | 
					                        if (_noneParameter == false)
 | 
				
			||||||
                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
					                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    ++colidx2;
 | 
					                    ++colidx2;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -434,15 +434,12 @@ namespace FreeSql.Internal.CommonProvider
 | 
				
			|||||||
            if (col.Attribute.MapType == col.CsType) val = value;
 | 
					            if (col.Attribute.MapType == col.CsType) val = value;
 | 
				
			||||||
            else val = Utils.GetDataReaderValue(col.Attribute.MapType, value);
 | 
					            else val = Utils.GetDataReaderValue(col.Attribute.MapType, value);
 | 
				
			||||||
            _set.Append(", ").Append(_commonUtils.QuoteSqlName(col.Attribute.Name)).Append(" = ");
 | 
					            _set.Append(", ").Append(_commonUtils.QuoteSqlName(col.Attribute.Name)).Append(" = ");
 | 
				
			||||||
            if (_noneParameter)
 | 
					
 | 
				
			||||||
            {
 | 
					            var colsql = _noneParameter ? _commonUtils.GetNoneParamaterSqlValue(_params, "u", col, col.Attribute.MapType, val) :
 | 
				
			||||||
                _set.Append(_commonUtils.GetNoneParamaterSqlValue(_params, "u", col, col.Attribute.MapType, val));
 | 
					                _commonUtils.QuoteWriteParamter(col.Attribute.MapType, $"{_commonUtils.QuoteParamterName("p_")}{_params.Count}");
 | 
				
			||||||
            }
 | 
					            _set.Append(_commonUtils.QuoteWriteColumn(col, colsql));
 | 
				
			||||||
            else
 | 
					            if (_noneParameter == false)
 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                _set.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, $"{_commonUtils.QuoteParamterName("p_")}{_params.Count}"));
 | 
					 | 
				
			||||||
                _commonUtils.AppendParamter(_params, null, col, col.Attribute.MapType, val);
 | 
					                _commonUtils.AppendParamter(_params, null, col, col.Attribute.MapType, val);
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public IUpdate<T1> Set<TMember>(Expression<Func<T1, TMember>> column, TMember value)
 | 
					        public IUpdate<T1> Set<TMember>(Expression<Func<T1, TMember>> column, TMember value)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -698,13 +695,12 @@ namespace FreeSql.Internal.CommonProvider
 | 
				
			|||||||
                        else
 | 
					                        else
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            var val = col.GetDbValue(_source.First());
 | 
					                            var val = col.GetDbValue(_source.First());
 | 
				
			||||||
                            if (_noneParameter)
 | 
					
 | 
				
			||||||
                                sb.Append(_commonUtils.GetNoneParamaterSqlValue(_paramsSource, "u", col, col.Attribute.MapType, val));
 | 
					                            var colsql = _noneParameter ? _commonUtils.GetNoneParamaterSqlValue(_paramsSource, "u", col, col.Attribute.MapType, val) :
 | 
				
			||||||
                            else
 | 
					                                _commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"p_{_paramsSource.Count}"));
 | 
				
			||||||
                            {
 | 
					                            _set.Append(_commonUtils.QuoteWriteColumn(col, colsql));
 | 
				
			||||||
                                sb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"p_{_paramsSource.Count}")));
 | 
					                            if (_noneParameter == false)
 | 
				
			||||||
                                _commonUtils.AppendParamter(_paramsSource, null, col, col.Attribute.MapType, val);
 | 
					                                _commonUtils.AppendParamter(_paramsSource, null, col, col.Attribute.MapType, val);
 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        ++colidx;
 | 
					                        ++colidx;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -743,13 +739,12 @@ namespace FreeSql.Internal.CommonProvider
 | 
				
			|||||||
                                ToSqlWhen(cwsb, _table.Primarys, d);
 | 
					                                ToSqlWhen(cwsb, _table.Primarys, d);
 | 
				
			||||||
                                cwsb.Append(" THEN ");
 | 
					                                cwsb.Append(" THEN ");
 | 
				
			||||||
                                var val = col.GetDbValue(d);
 | 
					                                var val = col.GetDbValue(d);
 | 
				
			||||||
                                if (_noneParameter)
 | 
					
 | 
				
			||||||
                                    cwsb.Append(_commonUtils.GetNoneParamaterSqlValue(_paramsSource, "u", col, col.Attribute.MapType, val));
 | 
					                                var colsql = _noneParameter ? _commonUtils.GetNoneParamaterSqlValue(_paramsSource, "u", col, col.Attribute.MapType, val) :
 | 
				
			||||||
                                else
 | 
					                                    _commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"p_{_paramsSource.Count}"));
 | 
				
			||||||
                                {
 | 
					                                _set.Append(_commonUtils.QuoteWriteColumn(col, colsql));
 | 
				
			||||||
                                    cwsb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"p_{_paramsSource.Count}")));
 | 
					                                if (_noneParameter == false)
 | 
				
			||||||
                                    _commonUtils.AppendParamter(_paramsSource, null, col, col.Attribute.MapType, val);
 | 
					                                    _commonUtils.AppendParamter(_paramsSource, null, col, col.Attribute.MapType, val);
 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
                                if (val == null || val == DBNull.Value) nulls++;
 | 
					                                if (val == null || val == DBNull.Value) nulls++;
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            cwsb.Append(" END");
 | 
					                            cwsb.Append(" END");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,6 +54,12 @@ namespace FreeSql.Internal
 | 
				
			|||||||
        public abstract string NowUtc { get; }
 | 
					        public abstract string NowUtc { get; }
 | 
				
			||||||
        public abstract string QuoteWriteParamter(Type type, string paramterName);
 | 
					        public abstract string QuoteWriteParamter(Type type, string paramterName);
 | 
				
			||||||
        protected abstract string QuoteReadColumnAdapter(Type type, Type mapType, string columnName);
 | 
					        protected abstract string QuoteReadColumnAdapter(Type type, Type mapType, string columnName);
 | 
				
			||||||
 | 
					        public string QuoteWriteColumn(ColumnInfo col, string sql)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (string.IsNullOrWhiteSpace(col?.Attribute.RewriteSql) == false)
 | 
				
			||||||
 | 
					                return string.Format(col.Attribute.RereadSql, sql);
 | 
				
			||||||
 | 
					            return sql;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        public string QuoteReadColumn(ColumnInfo col, Type type, Type mapType, string columnName)
 | 
					        public string QuoteReadColumn(ColumnInfo col, Type type, Type mapType, string columnName)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = QuoteReadColumnAdapter(type, mapType, columnName);
 | 
					            var result = QuoteReadColumnAdapter(type, mapType, columnName);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,13 +73,12 @@ namespace FreeSql.Dameng.Curd
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        object val = col.GetDbValue(d);
 | 
					                        object val = col.GetDbValue(d);
 | 
				
			||||||
                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
					                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
				
			||||||
                        if (_noneParameter)
 | 
					
 | 
				
			||||||
                            sb.Append(_commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val));
 | 
					                        var colsql = _noneParameter ? _commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val) :
 | 
				
			||||||
                        else
 | 
					                            _commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}"));
 | 
				
			||||||
                        {
 | 
					                        sb.Append(_commonUtils.QuoteWriteColumn(col, colsql));
 | 
				
			||||||
                            sb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}")));
 | 
					                        if (_noneParameter == false)
 | 
				
			||||||
                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
					                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    ++colidx2;
 | 
					                    ++colidx2;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,13 +69,12 @@ namespace FreeSql.Odbc.Dameng
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        object val = col.GetDbValue(d);
 | 
					                        object val = col.GetDbValue(d);
 | 
				
			||||||
                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
					                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
				
			||||||
                        if (_noneParameter)
 | 
					
 | 
				
			||||||
                            sb.Append(_commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val));
 | 
					                        var colsql = _noneParameter ? _commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val) :
 | 
				
			||||||
                        else
 | 
					                            _commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}"));
 | 
				
			||||||
                        {
 | 
					                        sb.Append(_commonUtils.QuoteWriteColumn(col, colsql));
 | 
				
			||||||
                            sb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}")));
 | 
					                        if (_noneParameter == false)
 | 
				
			||||||
                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
					                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    ++colidx2;
 | 
					                    ++colidx2;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,13 +69,12 @@ namespace FreeSql.Odbc.Oracle
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        object val = col.GetDbValue(d);
 | 
					                        object val = col.GetDbValue(d);
 | 
				
			||||||
                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
					                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
				
			||||||
                        if (_noneParameter)
 | 
					
 | 
				
			||||||
                            sb.Append(_commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val));
 | 
					                        var colsql = _noneParameter ? _commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val) :
 | 
				
			||||||
                        else
 | 
					                            _commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}"));
 | 
				
			||||||
                        {
 | 
					                        sb.Append(_commonUtils.QuoteWriteColumn(col, colsql));
 | 
				
			||||||
                            sb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}")));
 | 
					                        if (_noneParameter == false)
 | 
				
			||||||
                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
					                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    ++colidx2;
 | 
					                    ++colidx2;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -82,13 +82,12 @@ namespace FreeSql.Oracle.Curd
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        object val = col.GetDbValue(d);
 | 
					                        object val = col.GetDbValue(d);
 | 
				
			||||||
                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
					                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
				
			||||||
                        if (_noneParameter)
 | 
					
 | 
				
			||||||
                            sb.Append(_commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val));
 | 
					                        var colsql = _noneParameter ? _commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val) :
 | 
				
			||||||
                        else
 | 
					                            _commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}"));
 | 
				
			||||||
                        {
 | 
					                        sb.Append(_commonUtils.QuoteWriteColumn(col, colsql));
 | 
				
			||||||
                            sb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}")));
 | 
					                        if (_noneParameter == false)
 | 
				
			||||||
                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
					                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if (didx == 0) sb.Append(" as ").Append(col.Attribute.Name);
 | 
					                    if (didx == 0) sb.Append(" as ").Append(col.Attribute.Name);
 | 
				
			||||||
                    ++colidx2;
 | 
					                    ++colidx2;
 | 
				
			||||||
@@ -147,13 +146,12 @@ namespace FreeSql.Oracle.Curd
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        object val = col.GetDbValue(d);
 | 
					                        object val = col.GetDbValue(d);
 | 
				
			||||||
                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
					                        if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
 | 
				
			||||||
                        if (_noneParameter)
 | 
					
 | 
				
			||||||
                            sb.Append(_commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val));
 | 
					                        var colsql = _noneParameter ? _commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col, col.Attribute.MapType, val) :
 | 
				
			||||||
                        else
 | 
					                            _commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}"));
 | 
				
			||||||
                        {
 | 
					                        sb.Append(_commonUtils.QuoteWriteColumn(col, colsql));
 | 
				
			||||||
                            sb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}")));
 | 
					                        if (_noneParameter == false)
 | 
				
			||||||
                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
					                            _params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    ++colidx2;
 | 
					                    ++colidx2;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user