Skip to content

Commit 7a5d44b

Browse files
authored
fix SqlAuthenticationMethod missing (#766)
* fix SqlAuthenticationMethod missing fix SMO 181.15.0 references SqlAuthenticationMethod which was removed from Microsoft.Data.SqlClient 7.0. The CLR can't intercept this via TypeResolve/AssemblyResolve because the type is referenced in assembly metadata of an already-loaded assembly. Fix: Avoided the ServerConnection(SqlConnection) constructor (which calls InitFromSqlConnection → references the missing type) in both places: * .
1 parent dc91325 commit 7a5d44b

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

readme.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This test:
5050
```cs
5151
await Verify(connection);
5252
```
53-
<sup><a href='/src/Tests/Tests.cs#L77-L81' title='Snippet source file'>snippet source</a> | <a href='#snippet-SqlServerSchema' title='Start of snippet'>anchor</a></sup>
53+
<sup><a href='/src/Tests/Tests.cs#L81-L85' title='Snippet source file'>snippet source</a> | <a href='#snippet-SqlServerSchema' title='Start of snippet'>anchor</a></sup>
5454
<!-- endSnippet -->
5555

5656
Will result in the following verified file:
@@ -69,7 +69,7 @@ await Verify(connection)
6969
// include only tables and views
7070
.SchemaIncludes(DbObjects.Tables | DbObjects.Views);
7171
```
72-
<sup><a href='/src/Tests/Tests.cs#L443-L449' title='Snippet source file'>snippet source</a> | <a href='#snippet-SchemaInclude' title='Start of snippet'>anchor</a></sup>
72+
<sup><a href='/src/Tests/Tests.cs#L447-L453' title='Snippet source file'>snippet source</a> | <a href='#snippet-SchemaInclude' title='Start of snippet'>anchor</a></sup>
7373
<!-- endSnippet -->
7474

7575
Available values:
@@ -107,7 +107,7 @@ await Verify(connection)
107107
_ => _ is TableViewBase ||
108108
_.Name == "MyTrigger");
109109
```
110-
<sup><a href='/src/Tests/Tests.cs#L468-L476' title='Snippet source file'>snippet source</a> | <a href='#snippet-SchemaFilter' title='Start of snippet'>anchor</a></sup>
110+
<sup><a href='/src/Tests/Tests.cs#L472-L480' title='Snippet source file'>snippet source</a> | <a href='#snippet-SchemaFilter' title='Start of snippet'>anchor</a></sup>
111111
<!-- endSnippet -->
112112

113113

@@ -129,7 +129,7 @@ command.CommandText = "select Value from MyTable";
129129
var value = await command.ExecuteScalarAsync();
130130
await Verify(value!);
131131
```
132-
<sup><a href='/src/Tests/Tests.cs#L252-L262' title='Snippet source file'>snippet source</a> | <a href='#snippet-Recording' title='Start of snippet'>anchor</a></sup>
132+
<sup><a href='/src/Tests/Tests.cs#L256-L266' title='Snippet source file'>snippet source</a> | <a href='#snippet-Recording' title='Start of snippet'>anchor</a></sup>
133133
<!-- endSnippet -->
134134

135135
Will result in the following verified file:
@@ -184,7 +184,7 @@ await Verify(
184184
sqlEntries = entries
185185
});
186186
```
187-
<sup><a href='/src/Tests/Tests.cs#L329-L359' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingSpecific' title='Start of snippet'>anchor</a></sup>
187+
<sup><a href='/src/Tests/Tests.cs#L333-L363' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingSpecific' title='Start of snippet'>anchor</a></sup>
188188
<!-- endSnippet -->
189189

190190

@@ -212,7 +212,7 @@ var sqlErrorsViaType = entries
212212
.Select(_ => _.Data)
213213
.OfType<ErrorEntry>();
214214
```
215-
<sup><a href='/src/Tests/Tests.cs#L385-L404' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingReadingResults' title='Start of snippet'>anchor</a></sup>
215+
<sup><a href='/src/Tests/Tests.cs#L389-L408' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingReadingResults' title='Start of snippet'>anchor</a></sup>
216216
<!-- endSnippet -->
217217

218218

src/Tests/Tests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ static Tests() =>
88
"VerifySqlServer",
99
connection =>
1010
{
11-
var server = new Server(new ServerConnection(connection));
11+
var serverConnection = new ServerConnection
12+
{
13+
ConnectionString = connection.ConnectionString,
14+
};
15+
var server = new Server(serverConnection);
1216
server.ConnectionContext.ExecuteNonQuery(
1317
"""
1418
CREATE TABLE

src/Verify.SqlServer/SchemaValidation/SqlScriptBuilder.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ static SqlScriptBuilder()
3131
public string BuildContent(SqlConnection connection)
3232
{
3333
var builder = new SqlConnectionStringBuilder(connection.ConnectionString);
34-
var server = new Server(new ServerConnection(connection));
34+
var serverConnection = new ServerConnection
35+
{
36+
ConnectionString = connection.ConnectionString,
37+
};
38+
var server = new Server(serverConnection);
3539

3640
return BuildContent(server, builder);
3741
}

0 commit comments

Comments
 (0)