- 优化 自定义表达式树解析时,开放(非公开)内部公共工具类 Utility.CommonUtils;

This commit is contained in:
28810 2020-09-28 03:11:33 +08:00
parent 3ba1e649e9
commit 070b9a1e66
2 changed files with 11 additions and 1 deletions

View File

@ -85,6 +85,11 @@ namespace FreeSql.DataAnnotations
/// <param name="exp"></param> /// <param name="exp"></param>
/// <returns></returns> /// <returns></returns>
string ParseExpression(Expression exp); string ParseExpression(Expression exp);
/// <summary>
/// (非公开)内部公共工具类方法
/// </summary>
CommonUtils CommonUtils { get; }
} }
class DefaultUtility : IUtility class DefaultUtility : IUtility
@ -92,8 +97,8 @@ namespace FreeSql.DataAnnotations
internal ExpressionCallContext _context; internal ExpressionCallContext _context;
public TableInfo GetTableByEntity(Type entityType) => _context?._commonExp._common.GetTableByEntity(entityType); public TableInfo GetTableByEntity(Type entityType) => _context?._commonExp._common.GetTableByEntity(entityType);
public string ParseExpression(Expression exp) => _context?._commonExp.ExpressionLambdaToSql(exp, _context._tsc.CloneDisableDiyParse()); public string ParseExpression(Expression exp) => _context?._commonExp.ExpressionLambdaToSql(exp, _context._tsc.CloneDisableDiyParse());
public CommonUtils CommonUtils => _context?._commonExp._common;
} }
} }
} }

View File

@ -292,6 +292,11 @@
<param name="exp"></param> <param name="exp"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="P:FreeSql.DataAnnotations.ExpressionCallContext.IUtility.CommonUtils">
<summary>
(非公开)内部公共工具类方法
</summary>
</member>
<member name="T:FreeSql.DataAnnotations.IndexAttribute"> <member name="T:FreeSql.DataAnnotations.IndexAttribute">
<summary> <summary>
索引设置,如:[Index("{tablename}_idx_01", "name")] 索引设置,如:[Index("{tablename}_idx_01", "name")]