예제 #1
0
 /// <summary>
 /// 创建参数 SQL 表达式
 /// </summary>
 /// <param name="parameter">参数表达式</param>
 /// <returns>该参数在 SQL 语句中引用的形式</returns>
 public abstract string CreateParameterExpression( ParameterExpression parameter );
예제 #2
0
        /// <summary>
        /// 创建 TemplateExpression 对象
        /// </summary>
        /// <param name="template">模版</param>
        /// <param name="parameters">参数列表</param>
        public TemplateExpression( string template, params object[] parameters )
        {
            Template = template.Replace( "{...}", ParseParameterListSymbol( parameters.Length ) );

              Parameters = parameters.Select( item =>
              {
            var partial = item as ITemplatePartialExpression;
            if ( partial == null )
              partial = new ParameterExpression( item );
            return partial;
              } ).ToArray();

              var maxIndex = FormatRegexNum.Matches( Template ).Cast<Match>().Select( m => int.Parse( m.Groups["index"].Value ) ).Max();
              if ( maxIndex >= Parameters.Length )
            throw new IndexOutOfRangeException();
        }
예제 #3
0
 public SqlParameter CreateParameter( ParameterExpression expression, string name )
 {
     return new SqlParameter( name, expression.Value ?? DBNull.Value );
 }
예제 #4
0
 public override string CreateParameterExpression( ParameterExpression expression )
 {
     lock ( sync )
     {
       var name = "@Param" + list.Count;
       var parameter = CreateParameter( expression, name );
       list.Add( parameter );
       return name;
     }
 }
예제 #5
0
 public override string CreateParameterExpression( ParameterExpression parameter )
 {
     throw new NotImplementedException();
 }