Skip to content

Commit a29e814

Browse files
Moved SmiXetterAccessMap to shared src folder
Code merge for dotnet#1261 Issue for SmiXetterAccessMap class. Added the common code to .Common.cs class.
1 parent 647006e commit a29e814

File tree

4 files changed

+12
-61
lines changed

4 files changed

+12
-61
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@
145145
<Compile Include="..\..\src\Microsoft\Data\SqlClient\Server\SmiMetaData.cs">
146146
<Link>Microsoft\Data\SqlClient\Server\SmiMetaData.cs</Link>
147147
</Compile>
148+
<Compile Include="..\..\src\Microsoft\Data\SqlClient\Server\SmiXetterAccessMap.Common.cs">
149+
<Link>Microsoft\Data\SqlClient\Server\SmiXetterAccessMap.Common.cs</Link>
150+
</Compile>
148151
<Compile Include="..\..\src\Microsoft\Data\SqlClient\ColumnEncryptionKeyInfo.cs">
149152
<Link>Microsoft\Data\SqlClient\ColumnEncryptionKeyInfo.cs</Link>
150153
</Compile>
@@ -426,8 +429,6 @@
426429
<Compile Include="Microsoft\Data\SqlClient\Server\SmiEventSink_Default.cs" />
427430
<Compile Include="Microsoft\Data\SqlClient\Server\SmiMetaDataProperty.cs" />
428431
<Compile Include="Microsoft\Data\SqlClient\Server\SmiTypedGetterSetter.cs" />
429-
<Compile Include="Microsoft\Data\SqlClient\Server\SmiXetterAccessMap.cs" />
430-
<Compile Include="Microsoft\Data\SqlClient\Server\SqlDataRecord.cs" />
431432
<Compile Include="Microsoft\Data\SqlClient\Server\ValueUtilsSmi.cs" />
432433
<Compile Include="Microsoft\Data\SqlClient\SqlDbColumn.cs" />
433434
<Compile Include="$(CommonPath)\Microsoft\Data\Common\AdapterUtil.cs">
@@ -499,6 +500,7 @@
499500
</Compile>
500501
<Compile Include="Microsoft\Data\SqlClient\SqlDataAdapter.cs" />
501502
<Compile Include="Microsoft\Data\SqlClient\SqlDataReader.cs" />
503+
<Compile Include="Microsoft\Data\SqlClient\Server\SqlDataRecord.cs" />
502504
<Compile Include="Microsoft\Data\SqlClient\SqlDependency.cs" />
503505
<Compile Include="Microsoft\Data\SqlClient\SqlDependencyListener.cs" />
504506
<Compile Include="Microsoft\Data\SqlClient\SqlDependencyUtils.cs" />

src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@
192192
<Compile Include="..\..\src\Microsoft\Data\SqlClient\Server\SmiXetterTypeCode.cs">
193193
<Link>Microsoft\Data\SqlClient\Server\SmiXetterTypeCode.cs</Link>
194194
</Compile>
195+
<Compile Include="..\..\src\Microsoft\Data\SqlClient\Server\SmiXetterAccessMap.Common.cs">
196+
<Link>Microsoft\Data\SqlClient\Server\SmiXetterAccess.Common.cs</Link>
197+
</Compile>
195198
<Compile Include="..\..\src\Microsoft\Data\SqlClient\Server\SqlFacetAttribute.cs">
196199
<Link>Microsoft\Data\SqlClient\Server\SqlFacetAttribute.cs</Link>
197200
</Compile>

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.cs

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@ namespace Microsoft.Data.SqlClient.Server
88
{
99

1010
// Formal encoding of SMI's metadata-to-ITypedSetter/-from-ITypedGetter validity rules
11-
internal class SmiXetterAccessMap
11+
internal partial class SmiXetterAccessMap
1212
{
1313

14-
// A couple of private constants to make the getter/setter access tables more readable
15-
private const bool X = true;
16-
private const bool _ = false;
17-
1814
private static bool[,] __isGetterAccessValid = {
1915
// Getters as columns (abbreviated from XetterTypeCode names)
2016
// SqlDbTypes as rows
@@ -56,64 +52,12 @@ internal class SmiXetterAccessMap
5652
/*DTOffset*/{ _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , },
5753
};
5854

59-
private static bool[,] __isSetterAccessValid = {
60-
// Setters as columns (abreviated from XetterTypeCode names)
61-
// SqlDbTypes as rows
62-
// Current difference between setters and getters is that character setters do
63-
// not need to support SetBytes
64-
// bool, byte, bytes, chars, strng, int16, int32, int64, singl, doubl, sqldec, date, guid, varmd, Xetr, time, dtost
65-
/*BigInt*/ { _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
66-
/*Binary*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
67-
/*Bit*/ { X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
68-
/*Char*/ { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
69-
/*DTime*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , },
70-
/*Decimal*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , },
71-
/*Float*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , },
72-
/*Image*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
73-
/*Int*/ { _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
74-
/*Money*/ { _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
75-
/*NChar*/ { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
76-
/*NText*/ { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
77-
/*NVarChar*/{ _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
78-
/*Real*/ { _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , },
79-
/*UniqueId*/{ _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , },
80-
/*SmDTime*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , },
81-
/*SmInt*/ { _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
82-
/*SmMoney*/ { _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
83-
/*Text*/ { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
84-
/*Tstamp*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
85-
/*TinyInt*/ { _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
86-
/*VarBin*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
87-
/*VarChar*/ { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
88-
/*Variant*/ { X , X , X , X , X , X , X , X , X , X , X , X , X , X , _ , X , X , },
89-
/* 24 */ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
90-
/*Xml*/ { _ , _ , X , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
91-
/* 26 */ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
92-
/* 27 */ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
93-
/* 28 */ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
94-
/*Udt*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , },
95-
/*Struct*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , },
96-
/*Date*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , },
97-
/*Time*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , },
98-
/*DTime2*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , },
99-
/*DTOffset*/{ _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , },
100-
};
101-
10255
internal static bool IsGetterAccessValid(SmiMetaData metaData, SmiXetterTypeCode xetterType)
10356
{
10457
// Make sure no-one adds a new xetter type without updating this file!
10558
Debug.Assert(SmiXetterTypeCode.XetBoolean <= xetterType && SmiXetterTypeCode.XetDateTimeOffset >= xetterType);
10659

10760
return __isGetterAccessValid[(int)metaData.SqlDbType, (int)xetterType];
10861
}
109-
110-
internal static bool IsSetterAccessValid(SmiMetaData metaData, SmiXetterTypeCode xetterType)
111-
{
112-
// Make sure no-one adds a new xetter type without updating this file!
113-
Debug.Assert(SmiXetterTypeCode.XetBoolean <= xetterType && SmiXetterTypeCode.XetDateTimeOffset >= xetterType &&
114-
SmiXetterTypeCode.GetVariantMetaData != xetterType);
115-
116-
return __isSetterAccessValid[(int)metaData.SqlDbType, (int)xetterType];
117-
}
11862
}
11963
}

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.cs renamed to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.Common.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
namespace Microsoft.Data.SqlClient.Server
88
{
99
// Formal encoding of SMI's metadata-to-ITypedSetter/-from-ITypedGetter validity rules
10-
internal class SmiXetterAccessMap
10+
internal partial class SmiXetterAccessMap
1111
{
1212
// A couple of private constants to make the getter/setter access tables more readable
1313
private const bool X = true;
1414
private const bool _ = false;
1515

16-
16+
1717
private static bool[,] s_isSetterAccessValid = {
1818
// Setters as columns (abbreviated from XetterTypeCode names)
1919
// SqlDbTypes as rows
@@ -101,5 +101,7 @@ internal static bool IsSetterAccessValid(SmiMetaData metaData, SmiXetterTypeCode
101101

102102
return s_isSetterAccessValid[(int)metaData.SqlDbType, (int)xetterType];
103103
}
104+
105+
104106
}
105107
}

0 commit comments

Comments
 (0)