Skip to content

Commit e4cda4a

Browse files
authored
Merge | AssemblyCache (#3236)
* Move assemblycache to common project * Light cleanup - remove comments that make no sense anymore, make class static, couple style changes * Changing csproj to point to new file location * Forget it, let's just get rid of AssemblyCache! Thanks @edwardneal!
1 parent 04b0a8d commit e4cda4a

File tree

4 files changed

+20
-71
lines changed

4 files changed

+20
-71
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,6 @@
862862
<Compile Include="Microsoft\Data\Common\DbConnectionOptions.cs" />
863863
<Compile Include="Microsoft\Data\Common\DbConnectionString.cs" />
864864
<Compile Include="Microsoft\Data\Common\GreenMethods.cs" />
865-
<Compile Include="Microsoft\Data\SqlClient\assemblycache.cs" />
866865
<Compile Include="Microsoft\Data\SqlClient\BufferWriterExtensions.cs" />
867866
<Compile Include="Microsoft\Data\SqlClient\Reliability\SqlConfigurableRetryLogicManager.LoadType.cs" />
868867
<Compile Include="Microsoft\Data\SqlClient\Server\SmiConnection.cs" />

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2725,7 +2725,7 @@ internal byte[] GetBytes(object o)
27252725

27262726
internal byte[] GetBytes(object o, out Format format, out int maxSize)
27272727
{
2728-
SqlUdtInfo attr = AssemblyCache.GetInfoFromType(o.GetType());
2728+
SqlUdtInfo attr = GetInfoFromType(o.GetType());
27292729
maxSize = attr.MaxByteSize;
27302730
format = attr.SerializationFormat;
27312731

@@ -2743,5 +2743,24 @@ internal byte[] GetBytes(object o, out Format format, out int maxSize)
27432743
}
27442744
return retval;
27452745
}
2746+
2747+
private SqlUdtInfo GetInfoFromType(Type t)
2748+
{
2749+
Debug.Assert(t != null, "Type object can't be NULL");
2750+
Type orig = t;
2751+
do
2752+
{
2753+
SqlUdtInfo attr = SqlUdtInfo.TryGetFromType(t);
2754+
if (attr != null)
2755+
{
2756+
return attr;
2757+
}
2758+
2759+
t = t.BaseType;
2760+
}
2761+
while (t != null);
2762+
2763+
throw SQL.UDTInvalidSqlType(orig.AssemblyQualifiedName);
2764+
}
27462765
} // SqlConnection
27472766
} // Microsoft.Data.SqlClient namespace

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/assemblycache.cs

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlParameter.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,12 +1614,7 @@ internal int GetActualSize()
16141614
case SqlDbType.Udt:
16151615
if (!IsNull)
16161616
{
1617-
#if NETFRAMEWORK
1618-
//call the static function
1619-
coercedSize = AssemblyCache.GetLength(val);
1620-
#else
16211617
coercedSize = SerializationHelperSql9.SizeInBytes(val);
1622-
#endif
16231618
}
16241619
break;
16251620
case SqlDbType.Structured:

0 commit comments

Comments
 (0)