Skip to content

Commit 2ee72da

Browse files
committed
Add async methods in System.Data.Common, implement IAsyncDisposable
See https://github.com/dotnet/corefx/issues/35012
1 parent 181535a commit 2ee72da

7 files changed

+131
-10
lines changed

src/netstandard/ref/System.Data.Common.cs

+17-4
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ protected DbColumn() { }
208208
public System.Nullable<int> NumericScale { get { throw null; } protected set { } }
209209
public string UdtAssemblyQualifiedName { get { throw null; } protected set { } }
210210
}
211-
public abstract partial class DbCommand : System.ComponentModel.Component, System.Data.IDbCommand, System.IDisposable
211+
public abstract partial class DbCommand : System.ComponentModel.Component, System.Data.IDbCommand, System.IDisposable, System.IAsyncDisposable
212212
{
213213
protected DbCommand() { }
214214
[System.ComponentModel.DefaultValueAttribute("")]
@@ -260,9 +260,11 @@ protected DbCommand() { }
260260
public System.Threading.Tasks.Task<object> ExecuteScalarAsync() { throw null; }
261261
public virtual System.Threading.Tasks.Task<object> ExecuteScalarAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
262262
public abstract void Prepare();
263+
public virtual System.Threading.Tasks.Task PrepareAsync(System.Threading.CancellationToken cancellationToken = default) { throw null; }
263264
System.Data.IDbDataParameter System.Data.IDbCommand.CreateParameter() { throw null; }
264265
System.Data.IDataReader System.Data.IDbCommand.ExecuteReader() { throw null; }
265266
System.Data.IDataReader System.Data.IDbCommand.ExecuteReader(System.Data.CommandBehavior behavior) { throw null; }
267+
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
266268
}
267269
public abstract partial class DbCommandBuilder : System.ComponentModel.Component
268270
{
@@ -303,7 +305,7 @@ protected void RowUpdatingHandler(System.Data.Common.RowUpdatingEventArgs rowUpd
303305
protected abstract void SetRowUpdatingHandler(System.Data.Common.DbDataAdapter adapter);
304306
public virtual string UnquoteIdentifier(string quotedIdentifier) { throw null; }
305307
}
306-
public abstract partial class DbConnection : System.ComponentModel.Component, System.Data.IDbConnection, System.IDisposable
308+
public abstract partial class DbConnection : System.ComponentModel.Component, System.Data.IDbConnection, System.IDisposable, System.IAsyncDisposable
307309
{
308310
protected DbConnection() { }
309311
[System.ComponentModel.DefaultValueAttribute("")]
@@ -324,7 +326,9 @@ public virtual event System.Data.StateChangeEventHandler StateChange { add { } r
324326
public System.Data.Common.DbTransaction BeginTransaction() { throw null; }
325327
public System.Data.Common.DbTransaction BeginTransaction(System.Data.IsolationLevel isolationLevel) { throw null; }
326328
public abstract void ChangeDatabase(string databaseName);
329+
public virtual System.Threading.Tasks.Task ChangeDatabaseAsync(string databaseName, System.Threading.CancellationToken cancellationToken = default) { throw null; }
327330
public abstract void Close();
331+
public virtual System.Threading.Tasks.Task CloseAsync(System.Threading.CancellationToken cancellationToken = default) { throw null; }
328332
public System.Data.Common.DbCommand CreateCommand() { throw null; }
329333
protected abstract System.Data.Common.DbCommand CreateDbCommand();
330334
public virtual void EnlistTransaction(System.Transactions.Transaction transaction) { }
@@ -337,7 +341,11 @@ protected virtual void OnStateChange(System.Data.StateChangeEventArgs stateChang
337341
public virtual System.Threading.Tasks.Task OpenAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
338342
System.Data.IDbTransaction System.Data.IDbConnection.BeginTransaction() { throw null; }
339343
System.Data.IDbTransaction System.Data.IDbConnection.BeginTransaction(System.Data.IsolationLevel isolationLevel) { throw null; }
344+
protected virtual System.Threading.Tasks.ValueTask<DbTransaction> BeginDbTransactionAsync(IsolationLevel isolationLevel, System.Threading.CancellationToken cancellationToken) { throw null; }
345+
public System.Threading.Tasks.ValueTask<DbTransaction> BeginTransactionAsync(System.Threading.CancellationToken cancellationToken = default) { throw null; }
346+
public System.Threading.Tasks.ValueTask<DbTransaction> BeginTransactionAsync(IsolationLevel isolationLevel, System.Threading.CancellationToken cancellationToken = default) { throw null; }
340347
System.Data.IDbCommand System.Data.IDbConnection.CreateCommand() { throw null; }
348+
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
341349
}
342350
public partial class DbConnectionStringBuilder : System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable, System.ComponentModel.ICustomTypeDescriptor
343351
{
@@ -454,7 +462,7 @@ protected virtual void TerminateBatching() { }
454462
public int Update(System.Data.DataSet dataSet, string srcTable) { throw null; }
455463
public int Update(System.Data.DataTable dataTable) { throw null; }
456464
}
457-
public abstract partial class DbDataReader : System.MarshalByRefObject, System.Collections.IEnumerable, System.Data.IDataReader, System.Data.IDataRecord, System.IDisposable
465+
public abstract partial class DbDataReader : System.MarshalByRefObject, System.Collections.IEnumerable, System.Data.IDataReader, System.Data.IDataRecord, System.IDisposable, System.IAsyncDisposable
458466
{
459467
protected DbDataReader() { }
460468
public abstract int Depth { get; }
@@ -466,9 +474,11 @@ protected DbDataReader() { }
466474
public abstract int RecordsAffected { get; }
467475
public virtual int VisibleFieldCount { get { throw null; } }
468476
public virtual void Close() { }
477+
public virtual System.Threading.Tasks.Task CloseAsync(System.Threading.CancellationToken cancellationToken = default) { throw null; }
469478
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
470479
public void Dispose() { }
471480
protected virtual void Dispose(bool disposing) { }
481+
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
472482
public abstract bool GetBoolean(int ordinal);
473483
public abstract byte GetByte(int ordinal);
474484
public abstract long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length);
@@ -756,17 +766,20 @@ public sealed partial class DbProviderSpecificTypePropertyAttribute : System.Att
756766
public DbProviderSpecificTypePropertyAttribute(bool isProviderSpecificTypeProperty) { }
757767
public bool IsProviderSpecificTypeProperty { get { throw null; } }
758768
}
759-
public abstract partial class DbTransaction : System.MarshalByRefObject, System.Data.IDbTransaction, System.IDisposable
769+
public abstract partial class DbTransaction : System.MarshalByRefObject, System.Data.IDbTransaction, System.IDisposable, System.IAsyncDisposable
760770
{
761771
protected DbTransaction() { }
762772
public System.Data.Common.DbConnection Connection { get { throw null; } }
763773
protected abstract System.Data.Common.DbConnection DbConnection { get; }
764774
public abstract System.Data.IsolationLevel IsolationLevel { get; }
765775
System.Data.IDbConnection System.Data.IDbTransaction.Connection { get { throw null; } }
766776
public abstract void Commit();
777+
public virtual System.Threading.Tasks.Task CommitAsync(System.Threading.CancellationToken cancellationToken = default) { throw null; }
767778
public void Dispose() { }
779+
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
768780
protected virtual void Dispose(bool disposing) { }
769781
public abstract void Rollback();
782+
public virtual System.Threading.Tasks.Task RollbackAsync(System.Threading.CancellationToken cancellationToken = default) { throw null; }
770783
}
771784
public enum GroupByBehavior
772785
{

src/netstandard/src/ApiCompatBaseline.monoandroid.txt

+19-1
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,27 @@ TypeCannotChangeClassification : Type 'System.ComponentModel.Design.Serializatio
297297
CannotChangeAttribute : Attribute 'System.ObsoleteAttribute' on 'System.ComponentModel.Design.Serialization.RootDesignerSerializerAttribute' changed from '[ObsoleteAttribute("This attribute has been deprecated. Use DesignerSerializerAttribute instead. For example, to specify a root designer for CodeDom, use DesignerSerializerAttribute(...,typeof(TypeCodeDomSerializer)). https://go.microsoft.com/fwlink/?linkid=14202")]' in the contract to '[ObsoleteAttribute("This attribute has been deprecated. Use DesignerSerializerAttribute instead. For example, to specify a root designer for CodeDom, use DesignerSerializerAttribute(...,typeof(TypeCodeDomSerializer)). http://go.microsoft.com/fwlink/?linkid=14202")]' in the implementation.
298298
CannotRemoveAttribute : Attribute 'System.ComponentModel.ToolboxItemAttribute' exists on 'System.Data.DataSet' in the contract but not the implementation.
299299
CannotChangeAttribute : Attribute 'System.ObsoleteAttribute' on 'System.Data.DataSysDescriptionAttribute' changed from '[ObsoleteAttribute("DataSysDescriptionAttribute has been deprecated. https://go.microsoft.com/fwlink/?linkid=14202", false)]' in the contract to '[ObsoleteAttribute("DataSysDescriptionAttribute has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202", false)]' in the implementation.
300+
CannotRemoveBaseTypeOrInterface : Type 'System.Data.DataTableReader' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract.
301+
CannotRemoveBaseTypeOrInterface : Type 'System.Data.Common.DbCommand' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract.
302+
MembersMustExist : Member 'System.Data.Common.DbCommand.DisposeAsync()' does not exist in the implementation but it does exist in the contract.
303+
MembersMustExist : Member 'System.Data.Common.DbCommand.PrepareAsync(System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
304+
CannotRemoveBaseTypeOrInterface : Type 'System.Data.Common.DbConnection' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract.
305+
MembersMustExist : Member 'System.Data.Common.DbConnection.BeginDbTransactionAsync(System.Data.IsolationLevel, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
306+
MembersMustExist : Member 'System.Data.Common.DbConnection.BeginTransactionAsync(System.Data.IsolationLevel, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
307+
MembersMustExist : Member 'System.Data.Common.DbConnection.BeginTransactionAsync(System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
308+
MembersMustExist : Member 'System.Data.Common.DbConnection.ChangeDatabaseAsync(System.String, System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
309+
MembersMustExist : Member 'System.Data.Common.DbConnection.CloseAsync(System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
310+
MembersMustExist : Member 'System.Data.Common.DbConnection.DisposeAsync()' does not exist in the implementation but it does exist in the contract.
311+
CannotRemoveBaseTypeOrInterface : Type 'System.Data.Common.DbDataReader' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract.
312+
MembersMustExist : Member 'System.Data.Common.DbDataReader.CloseAsync(System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
313+
MembersMustExist : Member 'System.Data.Common.DbDataReader.DisposeAsync()' does not exist in the implementation but it does exist in the contract.
300314
TypesMustExist : Type 'System.Data.Common.DbProviderFactories' does not exist in the implementation but it does exist in the contract.
301315
MembersMustExist : Member 'System.Data.Common.DbProviderFactory.CanCreateCommandBuilder.get()' does not exist in the implementation but it does exist in the contract.
302316
MembersMustExist : Member 'System.Data.Common.DbProviderFactory.CanCreateDataAdapter.get()' does not exist in the implementation but it does exist in the contract.
317+
CannotRemoveBaseTypeOrInterface : Type 'System.Data.Common.DbTransaction' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract.
318+
MembersMustExist : Member 'System.Data.Common.DbTransaction.CommitAsync(System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
319+
MembersMustExist : Member 'System.Data.Common.DbTransaction.DisposeAsync()' does not exist in the implementation but it does exist in the contract.
320+
MembersMustExist : Member 'System.Data.Common.DbTransaction.RollbackAsync(System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
303321
MembersMustExist : Member 'System.Diagnostics.ProcessStartInfo.ArgumentList.get()' does not exist in the implementation but it does exist in the contract.
304322
MembersMustExist : Member 'System.Diagnostics.ProcessStartInfo.StandardInputEncoding.get()' does not exist in the implementation but it does exist in the contract.
305323
MembersMustExist : Member 'System.Diagnostics.ProcessStartInfo.StandardInputEncoding.set(System.Text.Encoding)' does not exist in the implementation but it does exist in the contract.
@@ -1026,4 +1044,4 @@ CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Xm
10261044
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Xml.Serialization.XmlChoiceIdentifierAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple=false)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue)]' in the implementation.
10271045
CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Serialization.XmlSchemaImporter' does not inherit from base type 'System.Xml.Serialization.SchemaImporter' in the implementation but it does in the contract.
10281046
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Xml.Serialization.XmlSerializerAssemblyAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Struct, AllowMultiple=false)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Struct)]' in the implementation.
1029-
Total Issues: 1027
1047+
Total Issues: 1045

0 commit comments

Comments
 (0)