Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit d9bc6e4

Browse files
author
Saurabh Singh
committed
Incorporated review comments
1. Cleaned up code based on review comments 2. Removed blank comments. 3. Removed the extra files that had made their way into the checkin
1 parent fc1e805 commit d9bc6e4

20 files changed

+61
-1056
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.22823.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.Common", "src\System.Data.Common.csproj", "{29EF8D53-8E84-4E49-B90F-5950A2FE7D54}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{29EF8D53-8E84-4E49-B90F-5950A2FE7D54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{29EF8D53-8E84-4E49-B90F-5950A2FE7D54}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{29EF8D53-8E84-4E49-B90F-5950A2FE7D54}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{29EF8D53-8E84-4E49-B90F-5950A2FE7D54}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

src/System.Data.Common/src/System.Data.Common.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1717
</PropertyGroup>
1818
<ItemGroup>
19-
<!-- A reference to the entire .NET Framework is automatically included -->
20-
</ItemGroup>
21-
<ItemGroup>
22-
<Compile Include="System\DBNull.cs" />
19+
<Compile Include="System\DBNull.cs" />
2320
<Compile Include="System\Data\CommandBehavior.cs" />
2421
<Compile Include="System\Data\CommandType.cs" />
2522
<Compile Include="System\Data\ConnectionState.cs" />

src/System.Data.Common/src/System/DBNull.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
// Copyright (c) Microsoft. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
////////////////////////////////////////////////////////////////////////////////
5-
// Void
6-
// This class represents a Missing Variant
7-
////////////////////////////////////////////////////////////////////////////////
8-
94
using System;
105

116

127
namespace System
138
{
149
public sealed class DBNull
1510
{
16-
//Package private constructor
1711
private DBNull()
1812
{
1913
}

src/System.Data.Common/src/System/Data/CommandBehavior.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ namespace System.Data
1010
[Flags()]
1111
public enum CommandBehavior
1212
{
13-
Default = 0, // with data, multiple results, may affect database, MDAC 68240
13+
Default = 0, // with data, multiple results, may affect database
1414
SingleResult = 1, // with data, force single result, may affect database
1515
SchemaOnly = 2, // column info, no data, no effect on database
1616
KeyInfo = 4, // column info + primary key information (if available)
17-
//
1817
SingleRow = 8, // data, hint single row and single result, may affect database - doesn't apply to child(chapter) results
1918
SequentialAccess = 0x10,
2019
CloseConnection = 0x20,

src/System.Data.Common/src/System/Data/Common/AdapterUtil.cs

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,19 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
using System.Threading.Tasks;
5-
using Res = System.SR;
65

7-
namespace System
8-
{
9-
internal static partial class SR
10-
{
11-
internal static string GetString(string value)
12-
{
13-
return value;
14-
}
15-
16-
internal static string GetString(string format, params object[] args)
17-
{
18-
return SR.Format(format, args);
19-
}
20-
}
21-
}
226

237

248
namespace System.Data.Common
259
{
2610
internal static class ADP
2711
{
28-
// The class ADP defines the exceptions that are specific to the Adapters.f
12+
// The class ADP defines the exceptions that are specific to the Adapters.
2913
// The class contains functions that take the proper informational variables and then construct
30-
// the appropriate exception with an error string obtained from the resource Framework.txt.
14+
// the appropriate exception with an error string obtained from the resource framework.
3115
// The exception is then returned to the caller, so that the caller may then throw from its
3216
// location so that the catcher of the exception will have the appropriate call stack.
3317
// This class is used so that there will be compile time checking of error messages.
34-
// The resource Framework.txt will ensure proper string text based on the appropriate
35-
// locale.
3618

3719
static internal Task<T> CreatedTaskWithException<T>(Exception ex)
3820
{
@@ -48,8 +30,9 @@ static internal Task<T> CreatedTaskWithCancellation<T>()
4830
return completion.Task;
4931
}
5032

33+
5134
// NOTE: Initializing a Task in SQL CLR requires the "UNSAFE" permission set (http://msdn.microsoft.com/en-us/library/ms172338.aspx)
52-
// Therefore we are lazily initializing these Tasks to avoid forcing customers to use the "UNSAFE" set when they are actually using no Async features (See Dev11
35+
// Therefore we are lazily initializing these Tasks to avoid forcing customers to use the "UNSAFE" set when they are actually using no Async features
5336
static private Task<bool> s_trueTask = null;
5437
static internal Task<bool> TrueTask
5538
{
@@ -76,51 +59,42 @@ static internal Task<bool> FalseTask
7659
}
7760
}
7861

79-
static internal void TraceExceptionAsReturnValue(Exception e)
80-
{
81-
}
8262
static internal ArgumentException Argument(string error)
8363
{
8464
ArgumentException e = new ArgumentException(error);
85-
TraceExceptionAsReturnValue(e);
8665
return e;
8766
}
8867
static internal ArgumentException Argument(string error, Exception inner)
8968
{
9069
ArgumentException e = new ArgumentException(error, inner);
91-
TraceExceptionAsReturnValue(e);
9270
return e;
9371
}
9472
static internal ArgumentException Argument(string error, string parameter)
9573
{
9674
ArgumentException e = new ArgumentException(error, parameter);
97-
TraceExceptionAsReturnValue(e);
9875
return e;
9976
}
10077
static internal ArgumentNullException ArgumentNull(string parameter)
10178
{
10279
ArgumentNullException e = new ArgumentNullException(parameter);
103-
TraceExceptionAsReturnValue(e);
10480
return e;
10581
}
10682
static internal InvalidOperationException InvalidOperation(string error)
10783
{
10884
InvalidOperationException e = new InvalidOperationException(error);
109-
TraceExceptionAsReturnValue(e);
11085
return e;
11186
}
11287
static internal NotSupportedException NotSupported()
11388
{
11489
NotSupportedException e = new NotSupportedException();
115-
TraceExceptionAsReturnValue(e);
11690
return e;
11791
}
11892
static internal void CheckArgumentLength(string value, string parameterName)
11993
{
12094
CheckArgumentNull(value, parameterName);
12195
if (0 == value.Length)
12296
{
123-
throw Argument(Res.GetString(Res.ADP_EmptyString, parameterName)); // MDAC 94859
97+
throw Argument(SR.Format(SR.ADP_EmptyString, parameterName));
12498
}
12599
}
126100
static internal void CheckArgumentNull(object value, string parameterName)
@@ -135,23 +109,23 @@ static internal void CheckArgumentNull(object value, string parameterName)
135109
//
136110
static internal ArgumentException ConnectionStringSyntax(int index)
137111
{
138-
return Argument(Res.GetString(Res.ADP_ConnectionStringSyntax, index));
112+
return Argument(SR.Format(SR.ADP_ConnectionStringSyntax, index));
139113
}
140114
static internal ArgumentException KeywordNotSupported(string keyword)
141115
{
142-
return Argument(Res.GetString(Res.ADP_KeywordNotSupported, keyword));
116+
return Argument(SR.Format(SR.ADP_KeywordNotSupported, keyword));
143117
}
144118
static internal ArgumentException InvalidKeyname(string parameterName)
145119
{
146-
return Argument(Res.GetString(Res.ADP_InvalidKey), parameterName);
120+
return Argument(SR.Format(SR.ADP_InvalidKey), parameterName);
147121
}
148122
static internal ArgumentException InvalidValue(string parameterName)
149123
{
150-
return Argument(Res.GetString(Res.ADP_InvalidValue), parameterName);
124+
return Argument(SR.Format(SR.ADP_InvalidValue), parameterName);
151125
}
152126
static internal ArgumentException ConvertFailed(Type fromType, Type toType, Exception innerException)
153127
{
154-
return ADP.Argument(Res.GetString(Res.SqlConvert_ConvertFailed, fromType.FullName, toType.FullName), innerException);
128+
return ADP.Argument(SR.Format(SR.SqlConvert_ConvertFailed, fromType.FullName, toType.FullName), innerException);
155129
}
156130
internal enum InternalErrorCode
157131
{
@@ -194,13 +168,13 @@ internal enum InternalErrorCode
194168
}
195169
static internal Exception InternalError(InternalErrorCode internalError)
196170
{
197-
return InvalidOperation(Res.GetString(Res.ADP_InternalProviderError, (int)internalError));
171+
return InvalidOperation(SR.Format(SR.ADP_InternalProviderError, (int)internalError));
198172
}
199173
internal const int DefaultConnectionTimeout = DbConnectionStringDefaults.ConnectTimeout;
200174

201175
static internal bool IsEmpty(string str)
202176
{
203-
return ((null == str) || (0 == str.Length));
177+
return string.IsNullOrEmpty(str);
204178
}
205179
}
206180
}

0 commit comments

Comments
 (0)