/// <summary> /// /// </summary> /// <param name="request"></param> /// <param name="parameterObject"></param> /// <returns></returns> private string Process(RequestScope request, object parameterObject) { SqlTagContext ctx = new SqlTagContext(); IList localChildren = _children; ProcessBodyChildren(request, ctx, parameterObject, localChildren); // Builds a 'dynamic' ParameterMap ParameterMap map = new ParameterMap(request.DataExchangeFactory); map.Id = _statement.Id + "-InlineParameterMap"; map.Initialize(_usePositionalParameters, request); map.Class = _statement.ParameterClass; // Adds 'dynamic' ParameterProperty IList parameters = ctx.GetParameterMappings(); int count = parameters.Count; for (int i = 0; i < count; i++) { map.AddParameterProperty((ParameterProperty)parameters[i]); } request.ParameterMap = map; string dynSql = ctx.BodyText; // Processes $substitutions$ after DynamicSql if (SimpleDynamicSql.IsSimpleDynamicSql(dynSql)) { dynSql = new SimpleDynamicSql(request, dynSql, _statement).GetSql(parameterObject); } return(dynSql); }
private string Process(RequestScope request, object parameterObject) { SqlTagContext ctx = new SqlTagContext(); IList localChildren = this._children; this.ProcessBodyChildren(request, ctx, parameterObject, localChildren); ParameterMap map = new ParameterMap(request.DataExchangeFactory) { Id = this._statement.Id + "-InlineParameterMap" }; map.Initialize(this._usePositionalParameters, request); map.Class = this._statement.ParameterClass; IList parameterMappings = ctx.GetParameterMappings(); int count = parameterMappings.Count; for (int i = 0; i < count; i++) { map.AddParameterProperty((ParameterProperty)parameterMappings[i]); } request.ParameterMap = map; string bodyText = ctx.BodyText; if (SimpleDynamicSql.IsSimpleDynamicSql(bodyText)) { bodyText = new SimpleDynamicSql(request, bodyText, this._statement).GetSql(parameterObject); } return(bodyText); }
/// <summary> /// 完成动态SQL语句中子语句的拼接 和 参数信息的取出 /// </summary> /// <param name="request"></param> /// <param name="parameterObject"></param> /// <returns></returns> private string Process(RequestScope request, object parameterObject) { SqlTagContext ctx = new SqlTagContext(); IList <ISqlChild> localChildren = children; ProcessBodyChildren(request, ctx, parameterObject, localChildren); #region 所有参数对应的属性类的集合信息放入到ParameterMap中 // Builds a 'dynamic' ParameterMap ParameterMap parameterMap = new ParameterMap( statement.Id + "-InlineParameterMap", statement.ParameterClass.FullName, string.Empty, statement.ParameterClass, dataExchangeFactory.GetDataExchangeForClass(null), usePositionalParameters); // Adds 'dynamic' ParameterProperty IList parameters = ctx.GetParameterMappings(); int count = parameters.Count; for (int i = 0; i < count; i++) { parameterMap.AddParameterProperty((ParameterProperty)parameters[i]); } request.ParameterMap = parameterMap; #endregion #region 完整的SQL语句 string dynSql = ctx.BodyText; if (statement is Procedure) { dynSql = dynSql.Replace(MARK_TOKEN, string.Empty).Replace(COMMA_TOKEN, string.Empty).Trim(); } // Processes $substitutions$ after DynamicSql if (SimpleDynamicSql.IsSimpleDynamicSql(dynSql)) { dynSql = new SimpleDynamicSql( dataExchangeFactory, dbHelperParameterCache, dynSql, statement).GetSql(parameterObject); } #endregion return(dynSql); }
/// <summary> /// /// </summary> /// <param name="request"></param> /// <param name="parameterObject"></param> /// <returns></returns> private string Process(RequestScope request, object parameterObject) { SqlTagContext ctx = new SqlTagContext(); IList <ISqlChild> localChildren = children; ProcessBodyChildren(request, ctx, parameterObject, localChildren); // Builds a 'dynamic' ParameterMap ParameterMap parameterMap = new ParameterMap( statement.Id + "-InlineParameterMap", statement.ParameterClass.FullName, string.Empty, statement.ParameterClass, dataExchangeFactory.GetDataExchangeForClass(null), usePositionalParameters); // Adds 'dynamic' ParameterProperty var parameters = ctx.GetParameterMappings(); parameterMap.AddParameterProperties(parameters); request.ParameterMap = parameterMap; string dynSql = ctx.BodyText; if (statement is Procedure) { dynSql = dynSql.Replace(MARK_TOKEN, string.Empty).Replace(COMMA_TOKEN, string.Empty).Trim(); } // Processes $substitutions$ after DynamicSql if (SimpleDynamicSql.IsSimpleDynamicSql(dynSql)) { dynSql = new SimpleDynamicSql( dataExchangeFactory, dbHelperParameterCache, dynSql, statement).GetSql(parameterObject); } return(dynSql); }