Skip to content

Commit 8597488

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

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);
@@ -754,17 +764,20 @@ public sealed partial class DbProviderSpecificTypePropertyAttribute : System.Att
754764
public DbProviderSpecificTypePropertyAttribute(bool isProviderSpecificTypeProperty) { }
755765
public bool IsProviderSpecificTypeProperty { get { throw null; } }
756766
}
757-
public abstract partial class DbTransaction : System.MarshalByRefObject, System.Data.IDbTransaction, System.IDisposable
767+
public abstract partial class DbTransaction : System.MarshalByRefObject, System.Data.IDbTransaction, System.IDisposable, System.IAsyncDisposable
758768
{
759769
protected DbTransaction() { }
760770
public System.Data.Common.DbConnection Connection { get { throw null; } }
761771
protected abstract System.Data.Common.DbConnection DbConnection { get; }
762772
public abstract System.Data.IsolationLevel IsolationLevel { get; }
763773
System.Data.IDbConnection System.Data.IDbTransaction.Connection { get { throw null; } }
764774
public abstract void Commit();
775+
public virtual System.Threading.Tasks.Task CommitAsync(System.Threading.CancellationToken cancellationToken = default) { throw null; }
765776
public void Dispose() { }
777+
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
766778
protected virtual void Dispose(bool disposing) { }
767779
public abstract void Rollback();
780+
public virtual System.Threading.Tasks.Task RollbackAsync(System.Threading.CancellationToken cancellationToken = default) { throw null; }
768781
}
769782
public enum GroupByBehavior
770783
{

src/netstandard/src/ApiCompatBaseline.monoandroid.txt

+19-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,25 @@ 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.
315+
CannotRemoveBaseTypeOrInterface : Type 'System.Data.Common.DbTransaction' does not implement interface 'System.IAsyncDisposable' in the implementation but it does in the contract.
316+
MembersMustExist : Member 'System.Data.Common.DbTransaction.CommitAsync(System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
317+
MembersMustExist : Member 'System.Data.Common.DbTransaction.DisposeAsync()' does not exist in the implementation but it does exist in the contract.
318+
MembersMustExist : Member 'System.Data.Common.DbTransaction.RollbackAsync(System.Threading.CancellationToken)' does not exist in the implementation but it does exist in the contract.
301319
MembersMustExist : Member 'System.Diagnostics.ProcessStartInfo.ArgumentList.get()' does not exist in the implementation but it does exist in the contract.
302320
MembersMustExist : Member 'System.Diagnostics.ProcessStartInfo.StandardInputEncoding.get()' does not exist in the implementation but it does exist in the contract.
303321
MembersMustExist : Member 'System.Diagnostics.ProcessStartInfo.StandardInputEncoding.set(System.Text.Encoding)' does not exist in the implementation but it does exist in the contract.
@@ -1022,4 +1040,4 @@ CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Xm
10221040
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.
10231041
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.
10241042
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.
1025-
Total Issues: 1023
1043+
Total Issues: 1041

0 commit comments

Comments
 (0)