11using System ;
2+ using System . Collections . Generic ;
23using System . Data ;
34using System . Data . Common ;
45using System . IO ;
@@ -27,6 +28,7 @@ public sealed class AseCommand : DbCommand
2728 private string _commandText ;
2829 private UpdateRowSource _updatedRowSource ;
2930 private bool ? _namedParameters ;
31+ internal readonly IDictionary < string , FormatItem > FormatItems ;
3032
3133 /// <summary>
3234 /// Constructor function for an <see cref="AseCommand"/> instance.
@@ -35,17 +37,16 @@ public sealed class AseCommand : DbCommand
3537 public AseCommand ( )
3638 {
3739 AseParameters = new AseParameterCollection ( ) ;
40+ FormatItems = new Dictionary < string , FormatItem > ( ) ;
3841 }
3942
4043 /// <summary>
4144 /// Constructor function for an <see cref="AseCommand"/> instance.
4245 /// Note: the instance will not be initialised with an AseConnection; before use this must be supplied.
4346 /// </summary>
4447 /// <param name="commandText">The command text to execute</param>
45- public AseCommand ( string commandText )
48+ public AseCommand ( string commandText ) : this ( )
4649 {
47- AseParameters = new AseParameterCollection ( ) ;
48-
4950 CommandText = commandText ;
5051 }
5152
@@ -54,14 +55,10 @@ public AseCommand(string commandText)
5455 /// </summary>
5556 /// <param name="commandText">The command text to execute</param>
5657 /// <param name="connection">The connection upon which to execute</param>
57- public AseCommand ( string commandText , AseConnection connection )
58+ public AseCommand ( string commandText , AseConnection connection ) : this ( commandText )
5859 {
5960 _connection = connection ;
6061 _transaction = connection . Transaction ;
61-
62- AseParameters = new AseParameterCollection ( ) ;
63-
64- CommandText = commandText ;
6562 }
6663
6764 /// <summary>
@@ -70,23 +67,13 @@ public AseCommand(string commandText, AseConnection connection)
7067 /// <param name="commandText">The command text to execute</param>
7168 /// <param name="connection">The connection upon which to execute</param>
7269 /// <param name="transaction">The transaction within which to execute</param>
73- public AseCommand ( string commandText , AseConnection connection , AseTransaction transaction )
70+ public AseCommand ( string commandText , AseConnection connection , AseTransaction transaction ) : this ( commandText , connection )
7471 {
75- _connection = connection ;
7672 _transaction = transaction ;
77-
78- AseParameters = new AseParameterCollection ( ) ;
79-
80- CommandText = commandText ;
8173 }
8274
83- internal AseCommand ( AseConnection connection )
84- {
85- _connection = connection ;
86- _transaction = connection . Transaction ;
87-
88- AseParameters = new AseParameterCollection ( ) ;
89- }
75+ internal AseCommand ( AseConnection connection ) : this ( string . Empty , connection , connection . Transaction )
76+ { }
9077
9178 /// <summary>
9279 /// Tries to cancel the execution of a <see cref="AseCommand" />.
@@ -126,11 +113,34 @@ public override void Cancel()
126113 return new AseParameter ( ) ;
127114 }
128115
116+ public AseParameter CreateParameter ( string name , object value , DbType dbType , int ? overrideUserType )
117+ {
118+ if ( _isDisposed )
119+ {
120+ throw new ObjectDisposedException ( nameof ( AseCommand ) ) ;
121+ }
122+ return new AseParameter ( name , value , dbType , overrideUserType ) ;
123+ }
124+
129125 protected override DbParameter CreateDbParameter ( )
130126 {
131127 return CreateParameter ( ) ;
132128 }
133129
130+ //command.SetParameter("@psComment", comment, DbType.String, 36);
131+ /// <summary>
132+ ///
133+ /// </summary>
134+ /// <param name="parameterName"></param>
135+ /// <param name="parameterValue"></param>
136+ /// <param name="dbType"></param>
137+ /// <param name="overrideUserType"></param>
138+ /// <returns></returns>
139+ public AseParameter CreateParameter ( string parameterName , string parameterValue , DbType dbType , int ? overrideUserType )
140+ {
141+ return new AseParameter ( parameterName , parameterValue , dbType , overrideUserType ) ;
142+ }
143+
134144 /// <summary>
135145 /// Executes a Transact-SQL statement against the connection and returns the number of rows affected.
136146 /// </summary>
0 commit comments