@@ -9,9 +9,9 @@ public partial class Query
99 {
1010 public Query AsInsert ( object data , bool returnId = false )
1111 {
12- var dictionary = BuildKeyValuePairsFromObject ( data ) ;
12+ var propertiesKeyValues = BuildKeyValuePairsFromObject ( data ) ;
1313
14- return AsInsert ( dictionary , returnId ) ;
14+ return AsInsert ( propertiesKeyValues , returnId ) ;
1515 }
1616
1717 public Query AsInsert ( IEnumerable < string > columns , IEnumerable < object > values )
@@ -21,12 +21,12 @@ public Query AsInsert(IEnumerable<string> columns, IEnumerable<object> values)
2121
2222 if ( ( columnsList ? . Count ?? 0 ) == 0 || ( valuesList ? . Count ?? 0 ) == 0 )
2323 {
24- throw new InvalidOperationException ( "Columns and Values cannot be null or empty") ;
24+ throw new InvalidOperationException ( $ " { nameof ( columns ) } and { nameof ( values ) } cannot be null or empty") ;
2525 }
2626
2727 if ( columnsList . Count != valuesList . Count )
2828 {
29- throw new InvalidOperationException ( "Columns count should be equal to Values count ") ;
29+ throw new InvalidOperationException ( $ " { nameof ( columns ) } and { nameof ( values ) } cannot be null or empty ") ;
3030 }
3131
3232 Method = "insert" ;
@@ -40,19 +40,19 @@ public Query AsInsert(IEnumerable<string> columns, IEnumerable<object> values)
4040 return this ;
4141 }
4242
43- public Query AsInsert ( IEnumerable < KeyValuePair < string , object > > data , bool returnId = false )
43+ public Query AsInsert ( IEnumerable < KeyValuePair < string , object > > values , bool returnId = false )
4444 {
45- if ( data == null || data . Any ( ) == false )
45+ if ( values == null || values . Any ( ) == false )
4646 {
47- throw new InvalidOperationException ( "Values dictionary cannot be null or empty") ;
47+ throw new InvalidOperationException ( $ " { values } argument cannot be null or empty") ;
4848 }
4949
5050 Method = "insert" ;
5151
5252 ClearComponent ( "insert" ) . AddComponent ( "insert" , new InsertClause
5353 {
54- Columns = data . Select ( x=> x . Key ) . ToList ( ) ,
55- Values = data . Select ( x => x . Value ) . ToList ( ) ,
54+ Columns = values . Select ( x=> x . Key ) . ToList ( ) ,
55+ Values = values . Select ( x => x . Value ) . ToList ( ) ,
5656 ReturnId = returnId ,
5757 } ) ;
5858
@@ -63,16 +63,16 @@ public Query AsInsert(IEnumerable<KeyValuePair<string, object>> data, bool retur
6363 /// Produces insert multi records
6464 /// </summary>
6565 /// <param name="columns"></param>
66- /// <param name="valuesCollection "></param>
66+ /// <param name="rowsValues "></param>
6767 /// <returns></returns>
68- public Query AsInsert ( IEnumerable < string > columns , IEnumerable < IEnumerable < object > > valuesCollection )
68+ public Query AsInsert ( IEnumerable < string > columns , IEnumerable < IEnumerable < object > > rowsValues )
6969 {
7070 var columnsList = columns ? . ToList ( ) ;
71- var valuesCollectionList = valuesCollection ? . ToList ( ) ;
71+ var valuesCollectionList = rowsValues ? . ToList ( ) ;
7272
7373 if ( ( columnsList ? . Count ?? 0 ) == 0 || ( valuesCollectionList ? . Count ?? 0 ) == 0 )
7474 {
75- throw new InvalidOperationException ( "Columns and valuesCollection cannot be null or empty") ;
75+ throw new InvalidOperationException ( $ " { nameof ( columns ) } and { nameof ( rowsValues ) } cannot be null or empty") ;
7676 }
7777
7878 Method = "insert" ;
@@ -84,7 +84,7 @@ public Query AsInsert(IEnumerable<string> columns, IEnumerable<IEnumerable<objec
8484 var valuesList = values . ToList ( ) ;
8585 if ( columnsList . Count != valuesList . Count )
8686 {
87- throw new InvalidOperationException ( "Columns count should be equal to each Values count") ;
87+ throw new InvalidOperationException ( $ " { nameof ( columns ) } count should be equal to each { nameof ( rowsValues ) } entry count") ;
8888 }
8989
9090 AddComponent ( "insert" , new InsertClause
@@ -115,6 +115,5 @@ public Query AsInsert(IEnumerable<string> columns, Query query)
115115
116116 return this ;
117117 }
118-
119118 }
120119}
0 commit comments