Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX | Add Component Model annotations to SqlConnectionStringBuilder class in netcore's src folder #1152

Merged
merged 7 commits into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@
<Compile Include="..\..\src\Resources\ResCategoryAttribute.cs">
<Link>Resources\ResCategoryAttribute.cs</Link>
</Compile>
<Compile Include="..\..\src\Resources\ResDescriptionAttribute.cs">
<Link>Resources\ResDescriptionAttribute.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard' OR '$(TargetGroup)' == 'netcoreapp' OR '$(IsUAPAssembly)' == 'true'">
<Compile Include="Microsoft.Data.SqlClient.TypeForwards.cs" />
Expand Down Expand Up @@ -829,7 +832,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Microsoft\Data\SqlClient\AAsyncCallContext.cs" />

<Compile Include="Resources\Strings.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Data.SqlTypes;
Expand All @@ -24,6 +25,10 @@
namespace Microsoft.Data.SqlClient
{
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/SqlCommand/*'/>
[DefaultEvent("RecordsAffected")]
[ToolboxItem(true)]
[DesignerCategory("")]
// TODO: Add designer attribute when Microsoft.VSDesigner.Data.VS.SqlCommandDesigner uses Microsoft.Data.SqlClient
public sealed partial class SqlCommand : DbCommand, ICloneable
{
private static int _objectTypeCount; // EventSource Counter
Expand Down Expand Up @@ -423,6 +428,11 @@ private SqlCommand(SqlCommand from) : this()
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/Connection/*'/>
/// [
[DefaultValue(null)]
[Editor("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, " + AssemblyRef.MicrosoftVSDesigner, "System.Drawing.Design.UITypeEditor, " + AssemblyRef.SystemDrawing)]
[ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Data)]
[ResDescription(StringsHelper.ResourceNames.DbCommand_Connection)]
new public SqlConnection Connection
{
get
Expand Down Expand Up @@ -499,6 +509,8 @@ private SqlInternalConnectionTds InternalTdsConnection
private static bool IsRetryEnabled => LocalAppContextSwitches.IsRetryEnabled;

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/RetryLogicProvider/*' />
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public SqlRetryLogicBaseProvider RetryLogicProvider
{
get
Expand All @@ -516,6 +528,10 @@ public SqlRetryLogicBaseProvider RetryLogicProvider
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/Notification/*'/>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] // MDAC 90471
[ResCategory(StringsHelper.ResourceNames.DataCategory_Notification)]
[ResDescription(StringsHelper.ResourceNames.SqlCommand_Notification)]
public SqlNotificationRequest Notification
{
get
Expand Down Expand Up @@ -547,6 +563,9 @@ internal SqlStatistics Statistics
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/Transaction/*'/>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[ResDescription(StringsHelper.ResourceNames.DbCommand_Transaction)]
new public SqlTransaction Transaction
{
get
Expand Down Expand Up @@ -588,6 +607,11 @@ protected override DbTransaction DbTransaction
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/CommandText/*'/>
[DefaultValue("")]
[Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlCommandTextEditor, " + AssemblyRef.MicrosoftVSDesigner, "System.Drawing.Design.UITypeEditor, " + AssemblyRef.SystemDrawing)]
[RefreshProperties(RefreshProperties.All)] // MDAC 67707
[ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Data)]
[ResDescription(StringsHelper.ResourceNames.DbCommand_CommandText)]
public override string CommandText
{
get
Expand All @@ -607,9 +631,15 @@ public override string CommandText
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/ColumnEncryptionSetting/*'/>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Data)]
[ResDescription(StringsHelper.ResourceNames.TCE_SqlCommand_ColumnEncryptionSetting)]
public SqlCommandColumnEncryptionSetting ColumnEncryptionSetting => _columnEncryptionSetting;

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/CommandTimeout/*'/>
[ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Data)]
[ResDescription(StringsHelper.ResourceNames.DbCommand_CommandTimeout)]
public override int CommandTimeout
{
get
Expand Down Expand Up @@ -650,6 +680,10 @@ private int DefaultCommandTimeout
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/CommandType/*'/>
[DefaultValue(System.Data.CommandType.Text)]
[RefreshProperties(RefreshProperties.All)]
[ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Data)]
[ResDescription(StringsHelper.ResourceNames.DbCommand_CommandType)]
public override CommandType CommandType
{
get
Expand Down Expand Up @@ -683,6 +717,10 @@ public override CommandType CommandType
// when the DataAdapter design wizard generates the insert/update/delete commands it will
// set the DesignTimeVisible property to false so that cmds won't appear as individual objects
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/DesignTimeVisible/*'/>
[DefaultValue(true)]
[DesignOnly(true)]
[Browsable(false)]
[EditorBrowsableAttribute(EditorBrowsableState.Never)]
public override bool DesignTimeVisible
{
get
Expand All @@ -699,6 +737,9 @@ public override bool DesignTimeVisible
public bool EnableOptimizedParameterBinding { get; set; }

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/Parameters/*'/>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Data)]
[ResDescription(StringsHelper.ResourceNames.DbCommand_Parameters)]
new public SqlParameterCollection Parameters
{
get
Expand All @@ -723,6 +764,9 @@ protected override DbParameterCollection DbParameterCollection
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/UpdatedRowSource/*'/>
[DefaultValue(System.Data.UpdateRowSource.Both)]
[ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Update)]
[ResDescription(StringsHelper.ResourceNames.DbCommand_UpdatedRowSource)]
public override UpdateRowSource UpdatedRowSource
{
get
Expand All @@ -747,6 +791,8 @@ public override UpdateRowSource UpdatedRowSource
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml' path='docs/members[@name="SqlCommand"]/StatementCompleted/*'/>
[ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_StatementCompleted)]
[ResDescription(StringsHelper.ResourceNames.DbCommand_StatementCompleted)]
public event StatementCompletedEventHandler StatementCompleted
{
add
Expand Down Expand Up @@ -2575,9 +2621,9 @@ protected override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior b
throw result.Exception.InnerException;
}
return result.Result;
},
CancellationToken.None,
TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.NotOnCanceled,
},
CancellationToken.None,
TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.NotOnCanceled,
TaskScheduler.Default
);
}
Expand Down Expand Up @@ -3733,13 +3779,13 @@ private SqlDataReader GetParameterEncryptionDataReader(out Task returnTask, Task
// Read the results of describe parameter encryption.
command.ReadDescribeEncryptionParameterResults(describeParameterEncryptionDataReader, describeParameterEncryptionRpcOriginalRpcMap);

#if DEBUG
#if DEBUG
// Failpoint to force the thread to halt to simulate cancellation of SqlCommand.
if (_sleepAfterReadDescribeEncryptionParameterResults)
{
Thread.Sleep(10000);
}
#endif
#endif
}
catch (Exception e)
{
Expand Down Expand Up @@ -4897,7 +4943,7 @@ private SqlDataReader RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavi
private Task RunExecuteReaderTdsSetupContinuation(RunBehavior runBehavior, SqlDataReader ds, string optionSettings, Task writeTask)
{
Task task = AsyncHelper.CreateContinuationTaskWithState(
task: writeTask,
task: writeTask,
state: _activeConnection,
onSuccess: (object state) =>
{
Expand Down
Loading