/// <summary>
 /// 初始化类<see cref="SqlExpressionVisitor"/>。
 /// </summary>
 /// <param name="sqlHelper">SQL操作特殊标识接口。</param>
 /// <param name="typeMapper">类型匹配。</param>
 /// <param name="memberTranslator">字段或属性转换接口。</param>
 /// <param name="methodCallTranslator">方法调用转换接口。</param>
 /// <param name="fragmentTranslator">代码段转换接口。</param>
 protected SqlExpressionVisitor(ISqlHelper sqlHelper, ITypeMapper typeMapper, IMemberTranslator memberTranslator, IMethodCallTranslator methodCallTranslator, IExpressionFragmentTranslator fragmentTranslator)
 {
     _sqlHelper            = sqlHelper;
     _typeMapper           = typeMapper;
     _memberTranslator     = memberTranslator;
     _methodCallTranslator = methodCallTranslator;
     _fragmentTranslator   = fragmentTranslator;
     Delimter = (info, _) => sqlHelper.DelimitIdentifier(info.Name);
 }
 /// <summary>
 /// 初始化类<see cref="SqlExpressionVisitor"/>。
 /// </summary>
 /// <param name="sqlHelper">SQL操作特殊标识接口。</param>
 /// <param name="typeMapper">类型匹配。</param>
 /// <param name="memberTranslator">字段或属性转换接口。</param>
 /// <param name="methodCallTranslator">方法调用转换接口。</param>
 /// <param name="fragmentTranslator">代码段转换接口。</param>
 /// <param name="schemaFunc">获取前缀代理方法。</param>
 protected SqlExpressionVisitor(ISqlHelper sqlHelper, ITypeMapper typeMapper, IMemberTranslator memberTranslator, IMethodCallTranslator methodCallTranslator, IExpressionFragmentTranslator fragmentTranslator, Func <Type, string> schemaFunc)
 {
     _sqlHelper            = sqlHelper;
     _typeMapper           = typeMapper;
     _memberTranslator     = memberTranslator;
     _methodCallTranslator = methodCallTranslator;
     _fragmentTranslator   = fragmentTranslator;
     Delimter = (info, type) => sqlHelper.DelimitIdentifier(info.Name, schemaFunc(type));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 格式化标识符,如列名称加上“[]”。
 /// </summary>
 /// <param name="name">标识字符串。</param>
 /// <returns>返回格式化后的字符串。</returns>
 protected virtual string Delimit(string name) => SqlHelper.DelimitIdentifier(name, GetAlias(typeof(TModel)));