1
1
using System ;
2
+ using System . Collections ;
3
+ using System . Collections . Generic ;
2
4
using System . IO ;
5
+ using System . Linq ;
3
6
using System . Reflection ;
4
7
using System . Text ;
5
8
using Microsoft . Data . Tools . Schema . Sql . Packaging ;
@@ -18,19 +21,34 @@ public void UsingVersion(SqlServerVersion version)
18
21
Console . WriteLine ( $ "Using SQL Server version { version } ") ;
19
22
}
20
23
21
- public void AddReference ( FileInfo referenceFile )
24
+ public void AddReference ( string referenceFile )
22
25
{
23
26
// Ensure that the model has been created
24
27
EnsureModelCreated ( ) ;
25
28
26
29
// Make sure the file exists
27
- if ( ! referenceFile . Exists )
30
+ if ( ! File . Exists ( referenceFile ) )
28
31
{
29
32
throw new ArgumentException ( $ "Unable to find reference file { referenceFile } ", nameof ( referenceFile ) ) ;
30
33
}
31
34
32
- Console . WriteLine ( $ "Adding reference to { referenceFile . FullName } ") ;
33
- Model . AddReference ( referenceFile . FullName ) ;
35
+ Console . WriteLine ( $ "Adding reference to { referenceFile } ") ;
36
+ Model . AddReference ( referenceFile , null ) ;
37
+ }
38
+
39
+ public void AddExternalReference ( string referenceFile , string externalParts )
40
+ {
41
+ // Ensure that the model has been created
42
+ EnsureModelCreated ( ) ;
43
+
44
+ // Make sure the file exists
45
+ if ( ! File . Exists ( referenceFile ) )
46
+ {
47
+ throw new ArgumentException ( $ "Unable to find reference file { referenceFile } ", nameof ( referenceFile ) ) ;
48
+ }
49
+
50
+ Console . WriteLine ( $ "Adding reference to { referenceFile } with external parts { externalParts } ") ;
51
+ Model . AddReference ( referenceFile , externalParts ) ;
34
52
}
35
53
36
54
public void AddSqlCmdVariables ( string [ ] variableNames )
@@ -78,8 +96,8 @@ public bool ValidateModel()
78
96
79
97
// Validate the model and write out validation messages
80
98
int validationErrors = 0 ;
81
- var messages = Model . Validate ( ) ;
82
- foreach ( var message in messages )
99
+ var validationMessages = Model . Validate ( ) ;
100
+ foreach ( var message in validationMessages )
83
101
{
84
102
if ( message . MessageType == DacMessageType . Error )
85
103
{
0 commit comments