mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 12:28:15 +08:00
- 修复 .net5 单文本部署读取注释报错;
This commit is contained in:
@ -57,7 +57,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
MasterPool.Return(conn);
|
||||
var after = new Aop.TraceAfterEventArgs(before, "", ex);
|
||||
_util?._orm?.Aop.TraceAfterHandler?.Invoke(this, after);
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
if (_trans.ContainsKey(tid)) CommitTransaction();
|
||||
_trans.TryAdd(tid, tran);
|
||||
@ -122,7 +122,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (requireTran) RollbackTransaction(ex);
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -102,7 +102,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
if (string.IsNullOrEmpty(sql)) return this;
|
||||
if (++_whereTimes > 1) _where.Append(" AND ");
|
||||
_where.Append("(").Append(sql).Append(")");
|
||||
_where.Append('(').Append(sql).Append(')');
|
||||
if (parms != null) _params.AddRange(_commonUtils.GetDbParamtersByObject(sql, parms));
|
||||
return this;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -282,7 +282,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -308,7 +308,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -360,7 +360,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -278,7 +278,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -350,7 +350,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -359,7 +359,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -429,7 +429,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -438,7 +438,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -464,7 +464,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -538,7 +538,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
if (_source == null || _source.Any() == false) return null;
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("INSERT INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append("(");
|
||||
sb.Append("INSERT INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append('(');
|
||||
var colidx = 0;
|
||||
foreach (var col in _table.Columns.Values)
|
||||
{
|
||||
@ -582,7 +582,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
}
|
||||
++colidx2;
|
||||
}
|
||||
if (isValues) sb.Append(")");
|
||||
if (isValues) sb.Append(')');
|
||||
onrow?.Invoke(d, didx, sb);
|
||||
++didx;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -85,7 +85,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -157,7 +157,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -166,7 +166,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -236,7 +236,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -245,7 +245,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -270,7 +270,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -72,7 +72,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -107,7 +107,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -175,7 +175,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -244,7 +244,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -291,7 +291,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -327,7 +327,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -741,7 +741,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -767,7 +767,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -817,7 +817,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -855,7 +855,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -892,7 +892,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -946,7 +946,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -983,7 +983,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -1040,7 +1040,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -1066,7 +1066,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -224,7 +224,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -289,7 +289,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -298,7 +298,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -327,7 +327,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -555,7 +555,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
public IUpdate<T1> Where(string sql, object parms = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sql)) return this;
|
||||
_where.Append(" AND (").Append(sql).Append(")");
|
||||
_where.Append(" AND (").Append(sql).Append(')');
|
||||
if (parms != null) _params.AddRange(_commonUtils.GetDbParamtersByObject(sql, parms));
|
||||
return this;
|
||||
}
|
||||
@ -587,7 +587,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
if (_source.Any() == false) return null;
|
||||
if (_table.ColumnsByCs.ContainsKey(CsName) == false) throw new Exception($"找不到 {CsName} 对应的列");
|
||||
if (thenValue == null) throw new ArgumentNullException("thenValue 参数不可为 null");
|
||||
if (thenValue == null) throw new ArgumentNullException(nameof(thenValue));
|
||||
|
||||
if (_source.Count == 0) return null;
|
||||
if (_source.Count == 1)
|
||||
@ -626,7 +626,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
}
|
||||
cwsb.Append(" END");
|
||||
if (nulls == _source.Count) sb.Append("NULL");
|
||||
else sb.Append(cwsb.ToString());
|
||||
else sb.Append(cwsb);
|
||||
cwsb.Clear();
|
||||
|
||||
return sb.ToString();
|
||||
@ -752,7 +752,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
else
|
||||
{
|
||||
ToSqlCaseWhenEnd(cwsb, col);
|
||||
sb.Append(cwsb.ToString());
|
||||
sb.Append(cwsb);
|
||||
}
|
||||
cwsb.Clear();
|
||||
}
|
||||
@ -790,7 +790,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
if (_source.Any())
|
||||
{
|
||||
if (_table.Primarys.Any() == false) throw new ArgumentException($"{_table.Type.DisplayCsharp()} 没有定义主键,无法使用 SetSource,请尝试 SetDto");
|
||||
sb.Append("(").Append(_commonUtils.WhereItems(_table, "", _source)).Append(")");
|
||||
sb.Append('(').Append(_commonUtils.WhereItems(_table, "", _source)).Append(')');
|
||||
}
|
||||
|
||||
if (_where.Length > 0)
|
||||
|
@ -72,7 +72,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -81,7 +81,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -145,7 +145,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -154,7 +154,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -182,7 +182,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -14,6 +14,7 @@ using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
@ -297,7 +298,7 @@ namespace FreeSql.Internal
|
||||
foreach (var i in ie)
|
||||
{
|
||||
isAny = true;
|
||||
if (ieidx > 0) sb.Append(",");
|
||||
if (ieidx > 0) sb.Append(',');
|
||||
if (ieidx == 0)
|
||||
{
|
||||
var itype = i.GetType();
|
||||
@ -308,7 +309,7 @@ namespace FreeSql.Internal
|
||||
++ieidx;
|
||||
}
|
||||
if (isAny == false) return "";
|
||||
sb.Append(")");
|
||||
sb.Append(')');
|
||||
return sb.ToString();
|
||||
}
|
||||
else if (dywhere is IEnumerable)
|
||||
@ -361,7 +362,7 @@ namespace FreeSql.Internal
|
||||
var indt = its.Select(a => pk1.GetDbValue(a)).Where(a => a != null).ToArray();
|
||||
if (indt.Any() == false) return null;
|
||||
if (indt.Length == 1) sbin.Append(" = ").Append(GetNoneParamaterSqlValue(null, null, pk1, pk1.Attribute.MapType, indt.First()));
|
||||
else sbin.Append(" IN (").Append(string.Join(",", indt.Select(a => GetNoneParamaterSqlValue(null, null, pk1, pk1.Attribute.MapType, a)))).Append(")");
|
||||
else sbin.Append(" IN (").Append(string.Join(",", indt.Select(a => GetNoneParamaterSqlValue(null, null, pk1, pk1.Attribute.MapType, a)))).Append(')');
|
||||
return sbin.ToString();
|
||||
}
|
||||
var dicpk = its.Length > 5 ? new Dictionary<string, bool>() : null;
|
||||
@ -377,7 +378,7 @@ namespace FreeSql.Internal
|
||||
{
|
||||
sb.Append(" OR (");
|
||||
sb.Append(filter.Substring(5));
|
||||
sb.Append(")");
|
||||
sb.Append(')');
|
||||
++iidx;
|
||||
}
|
||||
if (dicpk != null)
|
||||
@ -399,7 +400,7 @@ namespace FreeSql.Internal
|
||||
{
|
||||
sb.Append(" OR (");
|
||||
sb.Append(fil.Key);
|
||||
sb.Append(")");
|
||||
sb.Append(')');
|
||||
}
|
||||
}
|
||||
return iidx == 1 ? sb.Remove(0, 5).Remove(sb.Length - 1, 1).ToString() : sb.Remove(0, 4).ToString();
|
||||
@ -447,6 +448,7 @@ namespace FreeSql.Internal
|
||||
}
|
||||
}
|
||||
|
||||
static int _CodeBaseNotSupportedException = 0;
|
||||
/// <summary>
|
||||
/// 通过属性的注释文本,通过 xml 读取
|
||||
/// </summary>
|
||||
@ -464,7 +466,17 @@ namespace FreeSql.Internal
|
||||
var xmlPath = regex.Replace(localType.Assembly.Location, ".xml");
|
||||
if (File.Exists(xmlPath) == false)
|
||||
{
|
||||
if (string.IsNullOrEmpty(localType.Assembly.CodeBase)) return null;
|
||||
if (_CodeBaseNotSupportedException == 1) return null;
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(localType.Assembly.CodeBase)) return null;
|
||||
}
|
||||
catch (NotSupportedException) //NotSupportedException: CodeBase is not supported on assemblies loaded from a single-file bundle.
|
||||
{
|
||||
Interlocked.Exchange(ref _CodeBaseNotSupportedException, 1);
|
||||
return null;
|
||||
}
|
||||
|
||||
xmlPath = regex.Replace(localType.Assembly.CodeBase, ".xml");
|
||||
if (xmlPath.StartsWith("file:///") && Uri.TryCreate(xmlPath, UriKind.Absolute, out var tryuri))
|
||||
xmlPath = tryuri.LocalPath;
|
||||
|
Reference in New Issue
Block a user