Skip to content

Commit 0b383ee

Browse files
authored
Added support for new Microsoft.Data.SqlClient driver (#192)
1 parent 94f7d55 commit 0b383ee

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/Spring/Spring.Data/Data/Common/dbproviders_netcore.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,47 @@
5252

5353
</object>
5454

55+
<object id="MicrosoftSqlServer" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false">
56+
<constructor-arg name="dbMetaData">
57+
<object type="Spring.Data.Common.DbMetadata">
58+
<constructor-arg name="productName" value="Microsoft SQL Server" />
59+
<constructor-arg name="assemblyName" value="Microsoft.Data.SqlClient"/>
60+
<constructor-arg name="connectionType" value="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient"/>
61+
<constructor-arg name="commandType" value="Microsoft.Data.SqlClient.SqlCommand, Microsoft.Data.SqlClient"/>
62+
<constructor-arg name="parameterType" value="Microsoft.Data.SqlClient.SqlParameter, Microsoft.Data.SqlClient"/>
63+
<constructor-arg name="dataAdapterType" value="Microsoft.Data.SqlClient.SqlDataAdapter, Microsoft.Data.SqlClient"/>
64+
<constructor-arg name="commandBuilderType" value="Microsoft.Data.SqlClient.SqlCommandBuilder, Microsoft.Data.SqlClient"/>
65+
<constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/>
66+
<constructor-arg name="parameterDbType" value="System.Data.SqlDbType, System.Data"/>
67+
<constructor-arg name="parameterDbTypeProperty" value="SqlDbType"/>
68+
<constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
69+
<constructor-arg name="parameterNamePrefix" value="@"/>
70+
<constructor-arg name="exceptionType" value="Microsoft.Data.SqlClient.SqlException, Microsoft.Data.SqlClient"/>
71+
<constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/>
72+
<constructor-arg name="useParameterPrefixInSql" value="true"/>
73+
<constructor-arg name="bindByName" value="true"/>
74+
<!-- this is only true for .net 1.1 kept it here just in case we want to revert back to this strategy for
75+
obtaining error codes-->
76+
<constructor-arg name="errorCodeExceptionExpression" value="Errors[0].Number.ToString()"/>
77+
78+
<!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string-->
79+
<property name="ErrorCodes.BadSqlGrammarCodes">
80+
<value>102,156,170,207,208</value>
81+
</property>
82+
<property name="ErrorCodes.PermissionDeniedCodes">
83+
<value>229</value>
84+
</property>
85+
<property name="ErrorCodes.DataIntegrityViolationCodes">
86+
<value>544,2627,8114,8115</value>
87+
</property>
88+
<property name="ErrorCodes.DeadlockLoserCodes">
89+
<value>1205</value>
90+
</property>
91+
</object>
92+
</constructor-arg>
93+
94+
</object>
95+
5596
<!-- ORACLE -->
5697

5798
<alias name="Oracle" alias="System.Data.OracleClient"/>

0 commit comments

Comments
 (0)